On Fri, Feb 21, 2014 at 5:47 PM, Ricky Clarkson <[email protected]>wrote:
> To me, List(1, "a") should be a type error as it is in Haskell ([1, "a"])
>
I sympathize with this view. I can't remember last time I needed a
heterogeneous list and if I came upon such a need, I would probably try to
capture some commonality of all the elements in a trait and parameterize my
list on that.
But the discussion is still worth having even if it's a bit theoretical
because there are still a lot of unsolved questions surrounding the
interaction of variance and parametric polymorphism and I'd really like to
go down that rabbit hole to find out if a solution is workable or if ad hoc
polymorphism is the only reasonable way out.
I think language-supported union and intersection types are an interesting
new avenue in that field and I'm really looking forward to seeing how far
Ceylon can take them.
> and to denote a HList you should (and do) need to use something other than
> List. Similarly, to create a List<Integer|String> you should need some
> other syntax.
>
I can't think of a better syntax for this, and Ceylon took it a bit further
with its use of {} and *. All interesting and thought-provoking stuff. How
else would you prefer to write it?
> Otherwise, especially with type inference, you can end up with surprising
> type errors elsewhere, and code that's hard to read the types of.
>
Any code we can chew on? I have to admit my knowledge of Ceylon is mostly
theoretical at this point (I read a lot of docs and a lot of code but I
have written very little) but if what I read from the mailing-list is any
indication, things seem to be going pretty smoothly overall.
--
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.