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

Andrew P. Black black at cs.pdx.edu
Fri Sep 23 16:58:44 PDT 2011


One way to think about branding is that each branded object, in addition to having its real methods, has an additional nullary method called #<gensym>#.  Here the #'s signs are embedded in the name of the method to make it different from any legal Grace method name, and the <gensym> is the unique brand.  So two objects with the same set of visible operations but different brands (or one branded and the other not) would have different types exactly because of the difference observable at the brand method.


On 23 Sep 2011, at 14:14 , James Noble wrote:

> 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
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core



More information about the Grace-core mailing list