This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Re: Re: Re : Type Erasure

No replies
Alexis Agahi
Joined: 2011-03-10,
User offline. Last seen 42 years 45 weeks ago.

Sorry I was a little bit quick to reply.
And BTW I came to same wish as you, it would be great to do uniform
pattern matching ;)
But I dont see simple solution without cost here.

On Tue, Jun 14, 2011 at 8:49 PM, Angelo Corsaro wrote:
> Hello Alexis,
>
> On Jun 14, 11:00 am, Alexis Agahi wrote:
>> Quote for Programming in Scala 2nd Edition page 322 ;)
>> "The only exception to the erasure rule is arrays, because they are handled
>> specially in Java as well as in Scala. The element type of an array is
>> stored with the array value, so you can pattern match on it."
>
> I understand that as briefly mentioned (in parentheses) on my previous
> email -- yet, my point remains.
>
> If we ignore for one second the limitations imposed by the JVM (we can
> work around some of those), there is currently a non-uniform way of
> doing pattern matching on parametric types. My point was that for at
> least Scala Library and scala parametric classes the compiler could
> automatically inject a manifest as an hidden attributed and use this
> to make things works in presence of erasure.
>
> Cheers,
>    Angelo
>
>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland