|Layout syntax email@example.com (2003-12-03)|
|Re: Layout syntax firstname.lastname@example.org (Joachim Durchholz) (2003-12-08)|
|Re: Layout syntax email@example.com (2003-12-13)|
|Re: Layout syntax firstname.lastname@example.org (Carl Cerecke) (2003-12-13)|
|Re: Layout syntax email@example.com (Joachim Durchholz) (2003-12-14)|
|Re: Layout syntax firstname.lastname@example.org (2003-12-20)|
|Re: Layout syntax email@example.com (Joachim Durchholz) (2003-12-21)|
|Re: Layout syntax firstname.lastname@example.org (2003-12-23)|
|[12 later articles]|
|From:||Joachim Durchholz <email@example.com>|
|Date:||8 Dec 2003 00:20:25 -0500|
|Organization:||Oberberg Online Infosysteme|
|Posted-Date:||08 Dec 2003 00:20:25 EST|
Hans Aberg wrote:
> Relating to the discussions about layout syntax in threads "Use of
> punctuation in a language?" and "Significant indentation":
> My impression is that in math, the interpretation of formulas does not
> depend on the indentation of new lines; or, at least, I cannot recall
> any example where it does. There are certainly formulas with
> two-dimensional layouts, like matrices, graphs, diagrams of category
> theory and the like. But these do not change semantics with the
> indentation level.
This is probably because most mathematical objects don't have much of
a nested structure. That's also why I think that mathematical
tradition isn't a source of inspiration for questions in this specific
> Otherwise, a language with layout syntax, not mentioned here I think,
> is Haskell <http://haskell.org/>.
The other layout language that I know about is Python.
> But then one has the problem with
> equating each tab with 8 spaces, which makes correct human parsing
> difficult in editors making another choice.
This essentially means that this specific layout strategy isn't a good
one. It doesn't mean that layout strategies in general are a bad idea.
For example, one could make it an error if subsequent lines have
different leading whitespace patterns.
> Also, formulas that depend on the indentation levels is a common
> hurdle for programmers; such errors are hard for humans to
> detect. Then one has lost some of the advantages with the
> indentation syntax.
Any references? I don't know how indentation has been a "common hurdle"
with "hard-to-detect errors".
My position about indentation is this (just to clarify from what
perspective I'm looking):
Having both indentation and structured statements is redundant. In
other words, the indentation may be misleading about the real program
structure, with either the indentation structure or the program
structure being wrong. I had my share of such errors when I learned
programming; today, I'm still spending a lot of time to keep
indendation and program structure consistent. Using indentation right
from the beginning would eliminate the redundancy, and spare a lot of
time and frustration.
The space-vs-tabs problem is essentially a tool problem; tabs were
important years ago, but on a modern system, they create more trouble
than they solve. (In other words, a modern editor should convert all
tabs to spaces when storing to disk, and do a "smart indent detection
and space-to-tab conversion" when loading from disk. This is no more
difficult than any of the tab strategies that are already
Return to the
Search the comp.compilers archives again.