Python-indentation (Was: Re: Is the world coming to an end?)

Nick Sabalausky a at a.a
Sun Apr 3 02:11:15 PDT 2011


<ulrik.mikaelsson at gmail.com> wrote in message 
news:mailman.3049.1301786442.4748.digitalmars-d at puremagic.com...
>> PS I don't want to say every of Python's decisions is wrong. Many of them
>> are great (but defenitely not significant intendation).
> On a side-note, I thought the same, until I realised I hate redundancies
> even more than I hated forced code-styles. And code-indentation AND
> brackets are clearly redundant, since they pretty much convey the same
> information "block", only one is structural and the other visual.
>
> Nowadays, my complaint on Python-indentation are that they aren't fully
> enforcing a STRICT policy on indentation. Mixed-code indentation in 
> 3d-part
> can cause a lot of unexpected bugs.
>

My main objection to Python's indentation was always: It *doesn't* enforce 
*anything*. It makes *assumptions*. (Plus, I like to leave temporary 
debugging code unindented so it's easy to spot. And easy to remove before 
comitting.)

...But now I've simplified my stance on Python's indentation to: I'm very 
allergic to it. (Easier to say, and I don't end up needed to defend it ;) )

>
> Personally, I'd like to see a world where "plain old text" (whatever that
> means, considering all the related encoding and line-ending-problems
> constantly biting us multi-platform non-ASCII-people in the behind) were
> replaced with something just slightly higher-level, such as semantic 
> trees.
> For programming, the notion would be to, instead of storing "text", 
> storing
> the AST of the parsed code, letting the editor render the tree to the
> user's preferences, to create true separation between information (the
> structural code) and visualization (the readable code).
>
> If a standardized format for the serialized tree was used, VCS:es could 
> use
> it to record changes not as "lines changed", but changes in the AST.
> Name-changes would not change entire lines, but just the references to 
> that
> symbol. Wrapping a block of code into an "if-statement" could clearly be
> visualized, instead of appearing like a big chunk of code were COMPLETELY
> rewritten (when in reality it was just indented.)
>
> For other tree structured formats, if nothing else, efficient standardized
> tree-representation could significantly boost performance of some
> protocols. (XML, I'm looking at you)
>
> I know, it's not going to happen, but one can dream?
>

Yea, I've sometimes felt the same way. There's a program out there called 
JetBrains MPS that's sort of similar to that. It's interesting as a 
proof-of-concept, but it's so rediculously slow and bloated it makes a 
fully-loaded Eclipse seem as quick and lean as windows notepad (Just 
creating a new project took about half-an-hour, IIRC. 'Course, I'm on a 
32-bit single-core, but even still...) Been awhile since I tried it though, 
maybe it's gotten better since then.





More information about the Digitalmars-d mailing list