"Model 2" prototype implementation

Vlad Ureche vlad.ureche at gmail.com
Fri Aug 7 15:17:17 UTC 2015


Hi everyone,

I’m opening a new thread, since "Model 2" prototype status went in the
syntax and semantics direction and I don’t want to derail it. First of all,
this is very exciting news and it will make translating Scala code to
Valhalla quite straight-forward (except for a few acceptable restrictions).

I’m wondering how will the implementation work?
Specifically, in this example, which assumes a specialized Box class defined
here
<web.archive.org/web/20150801070114/http://cr.openjdk.java.net/~briangoetz/valhalla/specialization.html#erasure-example-a-simple-box-class>
:

Box<int> box = new Box<int>(4);
Box<any> box_any = box;

// what does get() return? and how does it return it?
System.out.println(box_any.get());

// even more interesting, how does this work:
System.out.println(box_any.t /* assuming the box value is visible */);

How do you translate the method calls and field accesses? Do they return
boxed values?

Thanks,
Vlad

PS: Shameless advertising — I recently worked on a paper describing the
pitfalls I’ve encountered in miniboxing <http://scala-miniboxing.org> when
using erased views (and specialized views) and how to mitigate them, which
has been accepted for PPPJ 2015. In case you’re interested, an earlier
draft is available here <http://infoscience.epfl.ch/record/208797?ln=en>.
​


More information about the valhalla-dev mailing list