[Grace-core] Inconsistent declaration syntax

James Noble kjx at ecs.vuw.ac.nz
Sat Aug 4 22:11:27 PDT 2012


>>> def name = T1 & T2
>> 
>> So I believe we can write both of these (or at least can in theory :-)
>> They set up name as referring to the reified type object.
>> But presumably unlike type declarations they can't be used as actual types;
> 
> Why not?

because the right-hand-side of a def is unrestricted, and can be very dynamic,
whereas we want static types to be amenable to static checking.

e.g. def WeirdType = (if (Random.fraction < 0.5) then {Number} else {String})    

Kim might say something about "type : Type"

I some ways I quite like it but pushes the type system much more towards research than current practice.

Or - that way lie Dragons.

James


More information about the Grace-core mailing list