[Grace-core] Inconsistent declaration syntax

Andrew P. Black black at cs.pdx.edu
Sun Aug 5 17:48:47 PDT 2012


On 4 Aug 2012, at 22:11, James Noble wrote:

>>>> 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 certainly agree that a type used as an annotation on a variable or method must be manifest if we want "static" type checking.   Attempting to use a type like WeirdType for such a purpose would certainly generate an error from the static type checker.  

But I was asking a different question:  why require a different syntax for the declarations?

	Andrew



More information about the Grace-core mailing list