[Grace-core] [A Graceful Blog] Comment: "From Lancaster to Portland"

James Noble kjx at ecs.vuw.ac.nz
Fri Sep 23 14:14:57 PDT 2011


Hi John

> I'll try to come up with an example.

that would be great -   
(I'm cc:ing grace-core as the others will be interested too - hope you don't mind)

> It would help if you'd tell me whether the type that every object carries with it
> is a nominal type or a structural type.

let's say structural for now
 - although with "branding" most objects will at least carry *both* 

an object declared as 

object { 
  def answer = 42
  var question : String = "Six By Nine"
  method m = { print "Hello World"  }
}

would have the type 

{
 answer -> Number
 question -> String
 question:= (s : String) 
 m  
}

types like Number and String will refer to other similarly-structural type definitions

> I find grace syntax still too confusing;
> I'll fake it with quasi-Java/scala.

well we should talk about that too!

If you write in the Java subset of Scala
  call methods "methods"  (instead of defs)
  call constant definitions "defs" (instead of vals)
  call self "self" (instead of this)
  put "{ }" around each lambda 
  and put "then" back into "if" statements

you're pretty much there anyway! 

(we have a rationale for each of these choices of course)

James


More information about the Grace-core mailing list