Regarding List(1, "a"), I guess shapeless can likely handle that and turn
it into either a HList whose first item is always an Int and whose second
is always a String, or some list of Either[Int, String]. I haven't used
shapeless but that sounds like it would be in that library's domain.

The Ceylon approach is interesting as a default; I'd prefer a
List<Integer|String> to a List[Any] any day.


On Fri, Feb 21, 2014 at 10:52 AM, Cédric Beust ♔ <[email protected]> wrote:

> On Fri, Feb 21, 2014 at 10:14 AM, Kevin Wright <[email protected]>
> wrote:
>
> It can directly duplicate anything available in Kotlin or Ceylon using
>> nothing more than built-in features
>>
>  Not really, because the type system doesn’t know about union and
> intersection types.
>
> scala> List(1, "a")
> res0: List[Any] = List(1, a)
>
> In Ceylon, the type of this list would be List<Integer|String>.
>
> Null support flows very naturally out of this also, without requiring
> hacks to make it work. For example, Null|Person can’t be assigned to a
> Person without proper checking, and it’s also aliased to Person? for
> convenience.
>  --
> Cédric
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Java Posse" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/javaposse.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups "Java 
Posse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/javaposse.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to