[Grace-core] Dialect Design Proposal

James Noble kjx at ecs.vuw.ac.nz
Mon Nov 26 02:34:02 PST 2012


> There may be reasons to do this, but it is something new.  Up until now, we have said that files = modules have an implicit
> 
> 	def <filename> = object { … } 
> 
> wrapped around them, which means that each time I import it, I get a new object.

I'm pretty sure you've only got a module once per program.
Otherwise, if say two different modules import module "A" - surely they should share the same module-object?
It's hard to see how you could communicate between modules otherwise.

> Implementing restriction using a checker seems OK, but  it seems to me that we need a standard one, and a standard annotation (perhaps "is local") for the checker to look for.

yes, and that's fine by me. 

> The discussion about not being able to inherit from objects convinces me that not being able to inherit from objects is ungraceful.   Eash new workaround that we invent to get around this wrong-headed restriction makes the restriction itself look more like a wart than a patch.   In particular, it's worse than the disease it was supposed to cure.

in the specific case: 

for modules, the primary question is whether they are generative or not - 
are modules singleton objects, or generators of objects - basically classes that produce multiple objects.
If they're classes, presumably we could make them type-generic too.

The alternative is that modules themselves create singleton objects, but those objects can include generative entities - classes.


in the general case: the only languages I know of where you can "inherit from objects" are the prototype based ones like Self and JavaScript.  Both those two - in practice - have arguably larger warts in their inheritance systems that the current Grace design.
We may well be stuck in a local maximum in the design space, but the other approaches I'm aware of have problems too.
We could e.g. go to a trait based design, but that would probably be *more* stratified, with objects build out of traits. 
rather than letting programmers inherit from objects directly. 

I understand Michael has a version of the dialect & module proposal going.
For now, I'd like to work with that and see how that goes before heading back towards inheritance again.

James


More information about the Grace-core mailing list