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

Scala 3's -Yexplicit-nulls #188

Open
alexandru opened this issue Oct 23, 2023 · 6 comments
Open

Scala 3's -Yexplicit-nulls #188

alexandru opened this issue Oct 23, 2023 · 6 comments

Comments

@alexandru
Copy link
Member

Hello,

I noticed that version 0.5.0 doesn't enable -Yexplicit-nulls on Scala 3.

Any reasons for it?

@armanbilge
Copy link
Member

Is it ready for use? e.g. @SethTisue on Discord a few months ago:

seconded that -Yexplicit-nulls isn't really that usable yet, but I just want to note that it's being worked on: scala/scala3#18112

https://discord.com/channels/632150470000902164/632150470000902166/1131611679566872698

@SethTisue
Copy link
Member

SethTisue commented Oct 23, 2023

Anyway, in general -Y flags should be considered guilty until proven innocent. -Y is a signal that something is internal and/or not-ready-for-prime-time

@alexandru
Copy link
Member Author

alexandru commented Oct 23, 2023

I'd enable it 🤷‍♂️

sbt-tpolecat is a plugin that enables errors in case of unused imports or unused variables, and there's nothing more annoying than that.

The “platform types” in Kotlin are well implemented, as the compiler is also looking at @NonNull and @Nullable annotations from Java's ecosystem. I hope that Scala implements that as well, but meanwhile, while we're waiting, I want explicit nulls for protection against Java APIs, and I don't mind using .nn all over the place.

@armanbilge
Copy link
Member

IMHO this issue also seems like a major impediment to using explicit nulls.

This use of Option is idiomatic for handling possibly-null values, so it seems ironic that it isn't available when using explicit nulls.

@alexandru
Copy link
Member Author

alexandru commented Oct 24, 2023

That untagged unions aren't used yet in the stdlib is such a pity, as it would improve type safety by a lot.

@kubukoz
Copy link
Member

kubukoz commented Nov 4, 2024

Anyway, in general -Y flags should be considered guilty until proven innocent. -Y is a signal that something is internal and/or not-ready-for-prime-time

honestly the compiler/language doesn't do a great job at marketing this, I've worked in scala for 9 years and it's the first time I'm hearing that these aren't prime time 😅

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

4 participants