[Grace-core] reified generics -- good news / bad news

James Noble kjx at ecs.vuw.ac.nz
Tue Oct 11 04:17:07 PDT 2011


Following up on my earlier message:

On 7/10/2011, at 00:06 AM, James Noble wrote:

> Basically two of our principles "reified generics" and "operational semantics
> independent of types" doesn't seem to work. Or at least, they don't work
> if your computation can ever depend on the value of the reified generics.
> But if they can't, what's the value of reification?  As John B put it last week -
> we're back to Erasure.  oops. 

Dart has an interesting take on this. Basically Dart distinguishes between 
"static annotations" (may not affect semantics) and "reified type information"
(may affect semantics).   Hmmm.  As they put it:

> 1. Reified type information reflects the types of objects at runtime and may always be queried by dynamic typechecking constructs (the analogs of in- stanceOf, casts, typecase etc. in other languages). Reified type information includes class and interface declarations, the class of an object, and type arguments to constructors.
> 2. Static type annotations determine the types of variables and function decla- rations (including methods and constructors).
> 3. Production mode respects optional typing. Static type annotations do not affect runtime behavior.

The key Grace issue is when blocks are used as partial functions,
combined within the case statement. But Point #1 lets that right through.
So perhaps we don't have to worry overmuch about the philosophy of this.

James


More information about the Grace-core mailing list