"Model 2" prototype implementation
Brian Goetz
brian.goetz at oracle.com
Sat Aug 8 17:24:28 UTC 2015
Yes, we definitely need some way of expressing that. There's the
obvious autoboxing conversions for concrete primitives / values, but it
needs to be lifted to a general mechanism for conversion between any-T
and Object (for reference types, this is a the identity conversion.)
(IIRC Peter Levart posted a really hacky way to do this a few months
back, which is probably good enough to play with while we're working out
the real story?)
On 8/8/2015 1:15 PM, Vlad Ureche wrote:
> Brian, thanks the explanation!
>
> I’m very excited that the translation maps 1-to-1 to the Scala
> requirements
> <https://speakerdeck.com/vladureche/valhalla-the-good-the-bad-and-the-ugly-scaladays-2015-san-francisco?slide=170>
> (in the slide, the function R: Type -> Class is the right side, I called
> it Reference).
>
> There’s one thing I’d still like to have, if it doesn’t interact badly
> with other features.
> It’s in the same vein as |T.default|, only working inside
> classes/methods with anyfied type parameters:
>
> |Object T#box(T t) T T#unbox(Object t)v throws InvalidArgumentException |
>
> The boxing and unboxing operations could be patched in during the
> load-time class specialization (they could be wired to identity in the
> erased class).
> Would you be able to fit this in?
>
> Thanks a lot and looking forward to the full write-up!
> Vlad
>
> PS: Normally I’d pick up the prototype and play around instead of asking
> questions, but I’m writing my thesis, interviewing and preparing for
> welcoming a baby, so I’ve got quite a few balls in the air right now.
>
> On Fri, Aug 7, 2015 at 11:12 PM, Brian Goetz <brian.goetz at oracle.com
> <mailto:brian.goetz at oracle.com>> wrote:
>
> Yep, that's because we haven't told the whole translation story in
> its full gory detail yet. Stay tuned for the writeup. (Spoiler: it
> has to do with types with multiple avars where some are wildcarded
> and others are not, like Map<int, any>.)
>
>
> On 8/7/2015 5:03 PM, Guillaume Martres wrote:
>
> On Friday 07 August 2015 16:09:14 Brian Goetz wrote:
>
> Most dispatch on Foo<any> receivers can proceed without
> indy; the
> prototype happens to use it for dispatching all calls on
> Foo<any>
> receivers, but this is neither necessary nor optimal.
>
>
> Can you provide an example where it is necessary? I played a bit
> with the
> prototype but couldn't think of an example where it would.
>
>
More information about the valhalla-dev
mailing list