[2.11] :kind command outputs A for Any and Nothing

63 views
Skip to first unread message

Eugene Yokota

unread,
Oct 17, 2013, 10:47:13 AM10/17/13
to scala-i...@googlegroups.com
Hi,

2.11 adds [:kind][1] command to the REPL, which currently outputs Any and Nothing's kind to be A.

scala> :kind -v Nothing
scala.Nothing's kind is A
*
This is a proper type.

scala> :kind -v Any
java.lang.Object's kind is A
*
This is a proper type.

Inspired by Jason saying "Any and nothing are kind polymorphic in scala." @xuwei_k blogged that
the above :kind outputs may be inaccurate since they can be used in place of a type constructor:

class A[X]

class B[X[_]]

class C[X[_[_]]]

new A[Any]
new B[Any]
new C[Any]

new A[Nothing]
new B[Nothing]
new C[Nothing]

This is backed by SLS 3.5.2 "For every type constructor T (with any number of type parameters), scala.Nothing <: T <: scala.Any."

What should the correct :kind output be?
I am thinking about something like "scala.Nothing is a bottom type for all kinds" and "scala.Any is a top type for all kinds."

-eugene


Reply all
Reply to author
Forward
0 new messages