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

2011-04-03 Thread Nick Sabalausky
 wrote in message 
news:mailman.3049.1301786442.4748.digitalmar...@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.





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

2011-04-02 Thread Andrei Alexandrescu

On 4/2/11 8:01 PM, bearophile wrote:

PS I don't want to say every of Python's decisions is wrong. Many of them
are great (but defenitely not significant intendation).


There's a large difference between Python and D design process: Python devs discuss ideas 
about possible designs, even for days, and then the most preferred one is chosen. Only in 
uncommon cases, when there is no consensus, Guido chooses (like in the "X if P else 
Y" syntax). This, and the care they give to that process (they believe that good 
syntax matters), produce a language that's very well designed (despite some flaws).

Bye,
bearophile


That's how it works for D too.

Andrei


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

2011-04-02 Thread Daniel Gibson
Am 03.04.2011 03:01, schrieb bearophile:
>>> PS I don't want to say every of Python's decisions is wrong. Many of them  
>>> are great (but defenitely not significant intendation).
> 
> There's a large difference between Python and D design process: Python devs 
> discuss ideas about possible designs, even for days, and then the most 
> preferred one is chosen. Only in uncommon cases, when there is no consensus, 
> Guido chooses (like in the "X if P else Y" syntax). This, and the care they 
> give to that process (they believe that good syntax matters), produce a 
> language that's very well designed (despite some flaws).
> 
> Bye,
> bearophile

IMHO D is a language that is very well designed (despite some flaws) as well, so
it seems like D's design process isn't any worse ;)


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

2011-04-02 Thread bearophile
> > PS I don't want to say every of Python's decisions is wrong. Many of them  
> > are great (but defenitely not significant intendation).

There's a large difference between Python and D design process: Python devs 
discuss ideas about possible designs, even for days, and then the most 
preferred one is chosen. Only in uncommon cases, when there is no consensus, 
Guido chooses (like in the "X if P else Y" syntax). This, and the care they 
give to that process (they believe that good syntax matters), produce a 
language that's very well designed (despite some flaws).

Bye,
bearophile


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

2011-04-02 Thread ulrik . mikaelsson
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.



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?