[Grace-core] Inconsistent declaration syntax

James Noble kjx at ecs.vuw.ac.nz
Sun Aug 5 18:07:34 PDT 2012


> 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.  

indeed  - and that would be the other way to do it - 
pinging the use, not definition of such a type. 

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

so what are the options?  Is this what you're getting at?
(eliding the := vs = redundancy on vars & defs) 

*consistent syntax with just ="

def name = expression
var name = expression 
method name(params) name(params) = {body}
type name = type_expression  
class name = {body} 

object { body } clearly doesn't fit in here

*consistent syntax without ="

def name expression
var name expression
type name expression 
method name(params) name(params) {body}
type name = type_expression
class name {body}

James


More information about the Grace-core mailing list