Opening book details…
Can I read Explicit Nulls with Unsafe Nulls on EtoBox?
Explicit Nulls with Unsafe Nulls by Yaoyu Zhao; Ondřej Lhoták is a scholarly article available to read on EtoBox.
What is Explicit Nulls with Unsafe Nulls about?
The explicit nulls feature was merged into Scala 3 compiler at the end of 2019, which makes Null no longer a subtype of all reference types. This is the first step to enforce null safety in Scala language. Since then, we are continuously improving the usability to help users migrating to explicit nulls more easily.The UncheckedNull (originally named JavaNull) was introduced in the original design to allow calling Java members unsafely . Due to limited usage and difficulty of implementation, we decided to discard this notion and introduced a new language feature, called UnsafeNulls. By simply importing scala.language-.unsafeNulls, users can create an "unsafe" scope. Inside this scope, Null will have similar semantic as in Scala without explicit nulls, which allows selecting members on nullable variables and assigning nullable values to non-nullable variables without checking. This is useful when a large chunk of Scala code is mainly interacting with nullable values from Java library.The community projects are used to evaluate this new feature. We found UnsafeNulls can significantly reduce the work of initial migration. This gives users more flexibility to migrate their projects grad
- Author
- Yaoyu Zhao; Ondřej Lhoták
- Publisher
- ACM
- Published
- 2022
- Language
- EN