Improve D's syntax to make it more python like

Chris wendlec at tcd.ie
Tue Mar 25 02:52:42 PDT 2014


On Friday, 21 March 2014 at 23:33:51 UTC, Ziad Hatahet wrote:
> I don't know if significant whitespace is actually "improving" 
> the syntax.
>
> "As a simple, self-contained example, consider the 
> representation of
> program structure. Some observers objected to Go's C-like block 
> structure
> with braces, preferring the use of spaces for indentation, in 
> the style of
> Python or Haskell. However, we have had extensive experience 
> tracking down
> build and test failures caused by cross-language builds where a 
> Python
> snippet embedded in another language, for instance through a 
> SWIG
> invocation, is subtly and invisibly broken by a change in the 
> indentation
> of the surrounding code. Our position is therefore that, 
> although spaces
> for indentation is nice for small programs, it doesn't scale 
> well, and the
> bigger and more heterogeneous the code base, the more trouble 
> it can cause.
> It is better to forgo convenience for safety and dependability, 
> so Go has
> brace-bounded blocks. "
>
> Source:  http://talks.golang.org/2012/splash.article
>
> --
> Ziad

+1

This is exactly my experience. A lot of people use Python for 
quick prototyping which doesn't involve more than a few hundered 
lines of code. Fine. If, however, you have a medium-to-big 
project in Python it is just one big annoyance. Python's syntax 
is prescriptive in the sense that it prescribes how your code 
should look like on the page ("to help you write clean code"). 
Even trivial things like copy and paste cause problems in Python 
(not to mention the "tab against space war"). As usual, 
(over-)prescriptiveness causes more problems than it solves in 
the long run.


More information about the Digitalmars-d mailing list