Improve D's syntax to make it more python like

Russel Winder russel at winder.org.uk
Sat Mar 22 10:43:35 PDT 2014


On Sat, 2014-03-22 at 16:14 +0000, Brian Rogoff wrote:
> On Saturday, 22 March 2014 at 13:03:06 UTC, Russel Winder wrote:
> > ALGOL60 did not have significant whitespace and an offside 
> > rule, just
> > like C, C++ and D don't, whereas Python, OCaml, etc. do.
> 
> I've programmed in OCaml for many years and I somehow missed the 
> significant whitespace.  Even the Revised syntax for OCaml (the 
> improved and unused one) did not use significant whitespace, 
> though I recall that there were unloved projects to provide such 
> a syntax.

I appear to have typed OCaml when I meant Haskell, possibly because I am
trying to build Unison. You are correct (obviously :-) OCaml does not
use an offside rule approach. In his response, Paulo points out that F#
does, I did not appreciate this, so that is definitely a WILT.

> C++ has a much nastier syntax than D (IMO of course :-) but the 
> SPECS proposal for a resyntaxed C++ never caught on. I liked some 
> of the improvements suggested there, in particular the more 
> Pascal-ish or Scala-ish declaration syntax, and would have liked 
> something like that in D, but there are so many more issues to be 
> fixed that daydreams of improved syntax seem frivolous to me.

The Scala, Go, Rust, etc. use of "type after variable name" reads better
for me, but C, C++, D, Java, Groovy, Ceylon are all "type before
variable" (well the C++ rule is spiral out, but…), so I just get used to
switching.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder



More information about the Digitalmars-d mailing list