Eq should extend AnyVal until Phantom types (now Erased terms) are ready
See original GitHub issueThat way, at least you can’t pass null
as an instance. The suggestion is not mine, it comes from https://www.reddit.com/r/programming/comments/6elim6/announcing_dotty_012rc1_a_major_step_towards/dimg0nz/.
import dotty.DottyPredef.{eqAny => _, _}
class Foo
object Main {
def bar[T](value: T)(implicit teq: Eq[T,T]) = value == value
def main(args: Array[String]): Unit = bar(new Foo)(null) //<--
}
@nicolasstucki , can Eq
be made a phantom type, now or later? I’m asking this at the design level for now.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Erased Definitions - Scala 3 - EPFL
We introduce erased terms to overcome this limitation: we are able to enforce the right constrains on terms at compile time. These terms...
Read more >typelevel/theory - Gitter
Is there a concept of 'uninhabited' types in Haskell? yes and no. Logically speaking, data Void is the closest, but haskell is non...
Read more >Existential types in Scala - Pedro Rodriguez
In this article we will be exploring existential types via a specific use case you may encounter in production code. But before we...
Read more >Constraining future extensions of immutable classes
This means that for final classes, which can't be extended, immutability can be in- ferred from the type. The same is not true...
Read more >Scala Reflection Library 2.13.1 - scala.reflect.runtime.JavaUniverse
Should not be instantiated directly, use scala.reflect.runtime.universe instead. Self Type: JavaUniverse; Source: JavaUniverse.scala. Linear Supertypes.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Phantom types do not exist anymore.
With
erased
, now we can just doHi Paolo, I am scanning the issues and thought maybe you want to take over some of the
Eq
stuff when you are here. So I am assigning issues as I see them.