|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
|
|
|
Re: Re: [scala] pattern matching with type parametersHow about, um, reifying a type if reification is necessary for it to
work properly, and not if not? (yeah, I know, separate compilation) 2009/5/29 Jorge Ortiz <jorge.ortiz@...>: > This is equivalent to reifying types on the JVM. > > It's hard to overstate the magnitude of this change. Let's just say ... it's > not trivial. > > I'd rather see selective reification, along the lines of how you can > selectively annotate types with @specialized. > > --j > > On Thu, May 28, 2009 at 4:42 PM, Alex Boisvert <boisvert@...> wrote: >> >> (Damn these send buttons that triggers by themselves!! Here's what I was >> writing...) >> >> It seems manifests are quite important and generally useful to support >> good OO practices. >> >> Why not have one scala.reflect.Manifest automatically added to all Scala >> classes for each type parameter and type member? >> >> Would this be such a memory or performance burden? And if it is, maybe >> we could have an annotation to disable the feature? >> >> I'm feeling we're going down the boilerplate road with this... maybe when >> manifests are fully fleshed out and no longer experimental they could be >> tightly integrated in the language? >> >> alex >> >> >> On Thu, May 28, 2009 at 4:37 PM, Alex Boisvert <boisvert@...> >> wrote: >>> >>> (Moving to -debate since I'm asking controversial question...) >>> >>> It seems manifest are quite important for >>> >>> Why not have one scala.reflect.Manifest automatically added to all Scala >>> classes for each type parameter and type member? >>> >>> Would this be such a memory or performance burden? And if it is, maybe >>> we could have an annotation to disable the feature. >>> >>> >>> >>> On Thu, May 28, 2009 at 4:29 PM, David Hall <dlwh@...> wrote: >>>> >>>> scala> case class Msg[T](implicit val manifest: >>>> scala.reflect.Manifest[T]) >>>> defined class Msg >>>> >>>> scala> case class StrMsg(s: String) extends Msg[String]; >>>> defined class StrMsg >>>> >>>> scala> (StrMsg("3"):Msg[String]) match { case m@ Msg() => >>>> println(m.manifest) } >>>> java.lang.String >>>> >>>> Not perfect, but it's a start. >>>> >>>> -- David >>>> >>>> On Thu, May 28, 2009 at 4:24 PM, PetarM <petarm@...> wrote: >>>> > >>>> > Hi all, >>>> > >>>> > Is it possible to pattern match case classes with type parameters. >>>> > E.g. if I >>>> > have >>>> > >>>> > case class Msg[T]() >>>> > >>>> > Can I have a match like this: >>>> > >>>> > receive { >>>> > case Msg[T] => ... some code that uses the type information T ... >>>> > } >>>> > >>>> > I know that the code above does not compile, but is there a way to >>>> > mimic its >>>> > meaning? >>>> > >>>> > Thanks, >>>> > Petar >>>> > >>>> > >>>> > -- >>>> > View this message in context: >>>> > http://www.nabble.com/pattern-matching-with-type-parameters-tp23771884p23771884.html >>>> > Sent from the Scala mailing list archive at Nabble.com. >>>> > >>>> > >>> >> > > |
|
|
Re: [scala] pattern matching with type parametersOn Thu, May 28, 2009 at 8:34 PM, Jorge Ortiz <jorge.ortiz@...> wrote:
This is equivalent to reifying types on the JVM. Maybe close but I'm not suggesting we go and fix Java. Only Scala types would contain full type information. It's hard to overstate the magnitude of this change. Let's just say ... it's not trivial. Selective reification because it's simpler? And if so, in what way? Or because you wouldn't want to burden every object with full type information? alex |
|
|
Re: Re: [scala] pattern matching with type parametersOn Fri, May 29, 2009 at 4:32 PM, Alex Boisvert <boisvert@...> wrote:
> On Thu, May 28, 2009 at 8:34 PM, Jorge Ortiz <jorge.ortiz@...> wrote: >> >> This is equivalent to reifying types on the JVM. > > Maybe close but I'm not suggesting we go and fix Java. Only Scala types > would contain full type information. > >> >> It's hard to overstate the magnitude of this change. Let's just say ... >> it's not trivial. >> >> I'd rather see selective reification, along the lines of how you can >> selectively annotate types with @specialized. > > Selective reification because it's simpler? And if so, in what way? > > Or because you wouldn't want to burden every object with full type > information? I'm not sure if Michel still reads this list, he could give more information on this. His PhD thesis is (also) about Scala runtime type information: http://library.epfl.ch/en/theses/?nr=3302 At the time it seemed too slow to be included in Scala by default. iulian -- « Je déteste la montagne, ça cache le paysage » Alphonse Allais |
|
|
Re: Re: [scala] pattern matching with type parametersOn Fri, May 29, 2009 at 7:44 AM, Iulian Dragos <jaguarul@...> wrote:
thanks iulian, i'll munch on that. http://lamp.epfl.ch/~schinz/thesis-final-A4.pdf --- « je déteste la jvm, elle cache mes types » ;) |
| Free embeddable forum powered by Nabble | Forum Help |