[Grace-core] Transparent Colours - Family Polymorphism in Grace?

James Noble kjx at ecs.vuw.ac.nz
Tue Jan 31 12:24:56 PST 2012


> The bodies of methods  are not indented!  The opening brace in the method header should demand an indent of what follows.

So I remember we decided that "Code layout cannot be inconsistent with grouping"

To me, that means a method body to the left of the method header *is* inconsistent;
but a method body at the same indentation is not inconsistent...

> And I think that we should requires that the line containing the closing brace should have the same indent as the line containing the opening brace.  This may be controversial, though.

yep

if (x =1) then {      // indent 0
  do stuff                // indent 2
 } else {                 // indent 1
  do other stuff      // indent 2
}                              // indent 0

is this OK or not?

(assuming I've the indents in the right places!)

the other thing the spec says is:

"A line break followed by an increase in the indent level implies a line continuation, whereas line break followed by the next line at the same or lesser indentation implies a semicolon (if one is permitted syntatically)."

it would be good to have a simple formal or operational description of these rules


I'm also thinking about whether we should define an abstract syntax (say as Grace types)
as well as a concrete syntax.  This would mean that 
 - we could build other tools more easily & interchangeably
     primarily type checkers, but also formatters, even a "fixer" - http://golang.org/cmd/
     (although we don't need that yet)
- formalisation would be based on the abstract syntax not the concrete syntax

James



More information about the Grace-core mailing list