Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support API profiles in the style of -release #17691

som-snytt started this conversation in Feature Requests
Discussion options

A sample homework:

Hey does anyone know how I can add an element to the end of a list in scala WITHOUT using :+?
I'm working on this recursion problem for my homework and the instruction is that I can only use List.empty, .isEmpty, .nonEmpty, .:: (cons), .head, .tail

It would be nice if a student could scalac --profile:homework1 which would surface only the allowed API on the classpath. This would work similarly to --release. The trick might be how to make it easy to specify and generate the permitted API as a ct.sym file.

IRL projects could use such a facility to restrict API usage. In particular, it would not only restrict to a platform version like -release, but disallow methods deemed substandard for any reason.

You must be logged in to vote

Replies: 4 comments

Comment options

som-snytt
Nov 17, 2022
Collaborator Author

This is a great idea! I'm glad I checked existing tickets before creating a new one. 💯

You must be logged in to vote
0 replies
Comment options

This seems like something that could be done with a scalafix rule considering that there's already one to disallow a set of symbols: https://github.com/vovapolu/scaluzzi/blob/6deedfd4c3d05b2fc33bf8d8080d05011d473613/scalafix/input/src/main/scala/test/DisableSimple.scala#L3-L20, so the dual should be possible too.

You must be logged in to vote
0 replies
Comment options

som-snytt
Nov 17, 2022
Collaborator Author

This would be a stronger feature, as only the specified profile is available for typechecking.

You must be logged in to vote
0 replies
Comment options

som-snytt
Jun 11, 2024
Collaborator Author

Module support would be nice. This issue is about leveraging relaxed modules, "just import it all", as opposed to "keep me from seeing something":

#20530

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Converted from issue

This discussion was converted from issue #17690 on May 31, 2023 10:27.

AltStyle によって変換されたページ (->オリジナル) /