Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally exclude deprecated elements from root imports #11347

Closed
som-snytt opened this issue Jan 10, 2019 · 4 comments
Closed

Optionally exclude deprecated elements from root imports #11347

som-snytt opened this issue Jan 10, 2019 · 4 comments

Comments

@som-snytt
Copy link

A compiler option so that root imports exclude deprecated elements, such as Stream in 2.13.

Root imports are necessarily privileged, as they intrude on all namespaces; this offers stricter quality control.

It would also be useful if the compiler could treat all deprecated elements as though they were already deleted, as the deprecator plugin did, but that is probably out of scope.

@SethTisue
Copy link
Member

may run afoul of scala/scala-dev#430

@som-snytt
Copy link
Author

Under the -Yimports umbrella, it would be nice (as was proposed) to be able to

-Yimports:scala.{Stream => _, _}

but short of that syntax, a helper option would be -Yimports-no-deprecated.

Any such option is just shorthand for a well-placed compilation unit that hides undesired members of the standard imports and introduces new elements available on a quasi-global basis. But the language mechanics of imports and name binding are unchanged.

@som-snytt
Copy link
Author

som-snytt commented Jan 14, 2019

I see Eugene just asked for this convenience #11317

Someone wanted to hide Stream from standard library on stackoverflow.

@som-snytt
Copy link
Author

Closing this enhancement because not a lot of interest in the space of custom context or code prelude.

A REPL could provide these features as a convenience. A codebase can already disable root imports and construct a namespace with ordinary means in the language.

@som-snytt som-snytt closed this as not planned Won't fix, can't repro, duplicate, stale Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants