-
Couldn't load subscription status.
- Fork 1.1k
Support API profiles in the style of -release #17691
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 4 comments
-
This is a great idea! I'm glad I checked existing tickets before creating a new one. 💯
Beta Was this translation helpful? Give feedback.
All reactions
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
-
This would be a stronger feature, as only the specified profile is available for typechecking.
Beta Was this translation helpful? Give feedback.
All reactions
-
Module support would be nice. This issue is about leveraging relaxed modules, "just import it all", as opposed to "keep me from seeing something":
Beta Was this translation helpful? Give feedback.