Closed KimBruce closed 7 years ago
I think that our intention was always to require indentation changes to be by a minimum of two spaces, both for continuation lines and for inner blocks. We should clarify the above wording.
I'm not surprised that minigrace gets this wrong; the parser is full of unexplained +1
s, and I have no way of knowing which of these should be +2
s. But that's a separate issue.
This was fixed in commit 9077d52
The latest version of the spec (beginning of layout section) says: "Grace uses braces for grouping. Code layout must be consistent with grouping: indentation must increase by at least two spaces after a brace. Statements are terminated by line breaks when the following line has the same or lesser indentation than the indentation of the line containing the start of the current statement. Statements may optionally be terminated by semicolons."
However, I believe we intended also to require continuation lines to be indented by at least two characters. I originally thought minigrace was inconsistent with the spec because of the following two examples, but by carefully reading the spec see that indenting by one is allowed.
Can we change it to requite an indentation of al least two characters for a continuation to be legal? I.e., an indentation by 1 more than the previous line is illegal in all circumstances.
Minigrace does not enforce indenting of continuations by at least two. The following program is legal:
The following gives an error message about a continuation line rather than complaining about what I want to characterize as improper indenting (which students would find more helpful if they do this accidentally):
produces
This error message is correct if the single indent is allowed, but I'd rather see a complaint about indenting.