Skip to content

Fix #7759: Rename JavaNull -> UncheckedNull #7782

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

Merged
merged 1 commit into from
Dec 16, 2019

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Dec 16, 2019

Before releasing the Dotty version with explicit nulls later this week, we want to make sure we get the names right, since these are hard to fix once people have started using them.

@abeln @olhotak @noti0na1 are you OK with UncheckedNull?

@odersky odersky requested review from noti0na1 and abeln December 16, 2019 16:42
@odersky odersky added this to the 0.21 Tech Preview milestone Dec 16, 2019
@odersky
Copy link
Contributor Author

odersky commented Dec 16, 2019

One other reason to go with UncheckedNull instead of JavaNull is that we might also need it for Scala 2.x code. @abeln @olhotak @noti0na1 Did you already consider the case of mixed Scala 2/Scala 3 codebases? How should this be handled?

@olhotak
Copy link
Contributor

olhotak commented Dec 16, 2019

Our position on Scala 2 code is to unsoundly assume that the types do not include null (i.e. to not nullify the types like we do for Java types). The underlying assumption is that Scala 2 code will eventually be ported to Scala 3, so we will eventually be sound once that happens, but we remain temporarily unsound to ease migration.

If instead we tried to be sound immediately, that would increase the migration burden, and more importantly, it might require a second migration back once the Scala 2 code does get ported to Scala 3. For example, if a Scala 2 method currently returns ArrayBuffer[AnyRef], in the first migration, you would have to modify the calling code to expect ArrayBuffer[AnyRef | Null], but when later the Scala 2 code is ported to Scala 3, you would have to migrate the calling code back to ArrayBuffer[AnyRef]. We especially want to avoid this double migration.

BTW I like the term UncheckedNull.

@odersky
Copy link
Contributor Author

odersky commented Dec 16, 2019

Our position on Scala 2 code is to unsoundly assume that the types do not include null (i.e. to not nullify the types like we do for Java types). The underlying assumption is that Scala 2 code will eventually be ported to Scala 3, so we will eventually be sound once that happens, but we remain temporarily unsound to ease migration.

That makes sense. null is used rarely in Scala anyway, so adding it everywhere to Scala-2 compiled classes just because we are not sure is probably overkill.

@odersky odersky merged commit e45f03e into scala:master Dec 16, 2019
@odersky odersky deleted the rename-javanull branch December 16, 2019 19:34
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

Successfully merging this pull request may close these issues.

3 participants