www.digitalmars.com         C & C++   DMDScript  

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

reply ulrik.mikaelsson gmail.com writes:
--90e6ba6155126c7a28049ff6e685
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes

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

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? --90e6ba6155126c7a28049ff6e685 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable &gt; PS I don&#39;t want to say every of Python&#39;s decisions is wrong. M= any of them are great (but defenitely not significant intendation).<br />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 ar= e clearly redundant, since they pretty much convey the same information &qu= ot;block&quot;, only one is structural and the other visual.<br /><br />Now= adays, my complaint on Python-indentation are that they aren&#39;t fully en= forcing a STRICT policy on indentation. Mixed-code indentation in 3d-part c= an cause a lot of unexpected bugs.<br /><br /><br />Personally, I&#39;d lik= e to see a world where &quot;plain old text&quot; (whatever that means, con= sidering all the related encoding and line-ending-problems constantly bitin= g us multi-platform non-ASCII-people in the behind) were replaced with some= thing just slightly higher-level, such as semantic trees. For programming, = the notion would be to, instead of storing &quot;text&quot;, storing the AS= T of the parsed code, letting the editor render the tree to the user&#39;s = preferences, to create true separation between information (the structural = code) and visualization (the readable code).<br /><br />If a standardized f= ormat for the serialized tree was used, VCS:es could use it to record chang= es not as &quot;lines changed&quot;, but changes in the AST. Name-changes w= ould not change entire lines, but just the references to that symbol. Wrapp= ing a block of code into an &quot;if-statement&quot; could clearly be visua= lized, instead of appearing like a big chunk of code were COMPLETELY rewrit= ten (when in reality it was just indented.)<br /><br />For other tree struc= tured formats, if nothing else, efficient standardized tree-representation = could significantly boost performance of some protocols. (XML, I&#39;m look= ing at you)<br /><br />I know, it&#39;s not going to happen, but one can dr= eam? --90e6ba6155126c7a28049ff6e685--
Apr 02 2011
next sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
 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
Apr 02 2011
next sibling parent Daniel Gibson <metalcaedes gmail.com> writes:
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 ;)
Apr 02 2011
prev sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
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
Apr 02 2011
prev sibling parent "Nick Sabalausky" <a a.a> writes:
<ulrik.mikaelsson gmail.com> wrote in message 
news:mailman.3049.1301786442.4748.digitalmars-d 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).

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.
Apr 03 2011