[Grace-core] [A Graceful Blog] Comment: "From Lancaster to Portland"
James Noble
kjx at ecs.vuw.ac.nz
Mon Sep 26 12:54:02 PDT 2011
> I would include "brand someName" in the type signature (along with method add()and(), etc.) For the purpose of type checking , an brand operates just like a parameterless method. The only difference is that the method's name is really #someName#, and you can't request a method with a name like that, because the corresponding message request is a syntax error.
OK - yes that makes sense. You could have multiple brands per object etc.
If you wanted to typecase on this, you'd need to look at the brand *and* require particular methods
to fix the resulting structural type --- this is why e.g. Donna M's Unity has each (user visible) brand
packaged together with a structural type - you only match if you have both the brand and the methods
you think belong with that brand.
For consistency / understandability, if we go this way, we'd probably want to make brands actually different from methods;
so they'd display as "brands" in a debugger, and actually couldn't be called etc.
Or we could just go with a simple language and do things by convention - perhaps with defs or vars.
But there is also the issue - although we can get this to work - as Andrew puts it on another topic:
> Remember, we have to be able to explain this stuff to students. If I were novice student, I would be very confused ...
the issue here is: examples in almost any other language will look simpler because of their "implicit branding"
(even in things like O'CAML)
James
More information about the Grace-core
mailing list