[Grace-core] Modules & Inheritance

Lex Spoon lex at lexspoon.org
Wed Oct 17 16:26:59 PDT 2012


It's so nice to hear people talking about good code, about Self idioms!

On the narrower topic of how dialect declarations should work, let me
throw in a brief proposal. It is based on two claims, the first of
which is speculative on my part.

1. Won't it eventually be desirable for the dialect declaration to do
something other than add more symbols? For example, are you sure
nobody will want to define a lazy evaluation dialect? An implicit
conversions dialect? A looser dialect for generated code? If the
dialect declaration is intended to support unbounded effects, then it
will be exceedingly difficult to make it work with lexical scoping
and/or with OO inheritance.

2. Stylish source code will never change the dialect at a fine-grained
level. That is, it would make code an unreadable puzzler, especially
for students, if it included three different dialects in the span of
twenty lines of code.

If those ring true, then a promising approach is to make the dialect
designator specific to a "compilation unit", which in typical Grace
implementations would be a file. Moreover, the dialect designator, if
present, must be placed at the top of the compilation unit. This
approach would enforce the good style in claim 2, and it would avoid
the tricky problems raised in claim 1.

Equally good would be to associate the dialect with some larger unit
of code than a compilation unit, but is there one?

Lex


More information about the Grace-core mailing list