Re:Sylph: the programming language I want
by zak_mc_kracken on Sunday March 01, 2015 @10:53AM
(#9127475)
You're using a double standard, here: if the computer is good at indenting brace based languages, then it is equally good at indenting languages without braces just based on the grammar.
[ Parent
| on HN ]
Re:Sylph: the programming language I want
by mindslight on Sunday March 01, 2015 @11:35AM
(#9127688)
Not at all. In this case, by 'languages without braces' we mean languages where indentation is part of the grammar. Python's grammar includes explicit INDENT/DEDENT tokens. It is impossible to reindent this mangled python:
if z:
print 'a'
print 'b'Why would it be improperly indented in the first place? How is removing the indentation any different from removing braces?
Sure, when you paste code somewhere that expects prose (Facebook status updates, for example), it will consolidate consecutive whitespace and thereby remove the indentation, but you shouldn't be pasting code into a place like that anyway, because no matter what you do it'll be unreadable, and most people aren't going to be interested enough to put it into their editor to autoformat.
Re:Sylph: the programming language I want
by mindslight on Sunday March 01, 2015 @01:27PM
(#9128259)
I did not make the value judgment you are arguing against.
Re:Sylph: the programming language I want
by mixmastamyk on Sunday March 01, 2015 @10:55PM
(#9130244)
Editors know that a python line ending in a colon must be indented and so indent it automatically. It wouldn't be hard to use the same method to reindent it.
No, lines following a line ending in a colon must be indented.
But the OP's point is that you can't know how many lines make up the indented block, since there is no explicit block-end-marker left if the indent is gone.
Re:Sylph: the programming language I want
by balquhidder on Monday March 02, 2015 @04:09AM
(#9131000)
>No, lines following a line ending in a colon must be indented.
Except if you have, for example, an if statement. if x: y() is valid.
Re:Sylph: the programming language I want
by mixmastamyk on Monday March 02, 2015 @05:16PM
(#9134722)
Yep, that's what I meant.