News for hackers. Stuff that matters.
Re:Sylph: the programming language I want by marcosdumay on Sunday March 01, 2015 @09:23AM (#9127101)
What's effortless is putting begin and end of blocks symbols only where they matter.

Haskell is particularly guilty of creating several different indenting possibilities, and does require constant intervention. Python is less bad, but still requires more effort than C for example.

Re:Sylph: the programming language I want by masklinn on Sunday March 01, 2015 @10:09AM (#9127260)
Er… you know Haskell's syntax is defined as braces-and-semicolons right? And the braceless-and-semicolons-free syntax is the addition of a few layout rules[0] for human convenience.

[0] https://www.haskell.org/onlinereport/syntax-iso.html#sect9.3

Re:Sylph: the programming language I want by sparkie on Sunday March 01, 2015 @12:13PM (#9127871)
The problem is the addition of "a few layout rules" turns the context-free syntax of the language into a context-sensitive one. For example, if you were to write a parser using just the information from the link you've posted, you can enter a scenario where the same piece of code pasted in two different places in a code base mean two different things.

Case in point: putting if _ then _ else on separate lines is fine, but inside a do-notation it causes problems because the layout stage inserts semicolons between the parts, and the production rules listed at the bottom of the page do not include optional semicolons in the "if" alternation. You need to indent the then/else to overcome it. This problem is fixed with a hack[0], which fortunately has no side-effects for the rest of the language, but it just shows that throwing together ad-hoc rules for parsing code, rather than well understood theory like LR parsing, is inviting room for problems.

With CFG subsets like LR/LL, every production rule in these grammars is also a valid LR/LL grammar - in other words, it's not only the entire grammar of a language that is context-free, but all the parts are too. An indentation-sensitive language is only context-free when looked at for the entire language grammar, but the individual production rules of are context-sensitive. You can't just copy and paste some code into the syntax without providing this context (by means of manually indenting the code).

[0]:https://ghc.haskell.org/trac/haskell-prime/wiki/DoAndIfThenE...

Re:Sylph: the programming language I want by marcosdumay on Monday March 02, 2015 @06:37AM (#9131385)
Yes, I know that. Currently I'm having a better result using parenthesis instead to completely escaping from the semantic blank lines. It's cleaner than using semicolons everywhere.

Anyway, Haskell is a very instructive example about how semantic indentation creates problems.

Re:Sylph: the programming language I want by seanmcdirmid on Sunday March 01, 2015 @09:35AM (#9127138)
You really have to design your language around it for it to work well. Haskell has a a lot of syntactic craziness in the name of simplicity.
Re:Sylph: the programming language I want by masklinn on Sunday March 01, 2015 @10:07AM (#9127249)
What? Haskell has a base language expressed in terms of braces and semicolons, and a relatively simple set of layout rules defining how the compiler can insert these braces and semicolons automatically.
Re:Sylph: the programming language I want by seanmcdirmid on Sunday March 01, 2015 @09:43PM (#9130053)
Right. I meant that Haskell has a whole lot of other weird syntax to consider, that make it hard to read compared to Python. It's use of indentation is not one of the problems.
Re:Sylph: the programming language I want by codygman on Monday March 02, 2015 @01:07AM (#9130534)
Charitably speaking, that is very confusing considering you responded to:

> Haskell is particularly guilty of creating several different indenting possibilities, and does require constant intervention

with:

> You really have to design your language around it for it to work well. Haskell has a a lot of syntactic craziness in the name of simplicity.

Where "it" would seemingly be indentation, implying Haskell wasn't designed around making indentation simple.