Improve D's syntax to make it more python like

1100110 0b1100110 at gmail.com
Sun Mar 23 06:01:52 PDT 2014


On 3/22/14, 12:43, Russel Winder wrote:
> 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.
>


I find I think of the type as an adjective, and since I'm only fluent in 
english it makes perfect sense that the "adjective" would come before 
the "noun".

What is X? X is an integer.  Integer describes what X is.

"type after variable name" just doesn't have that mental model to it, 
hence I like it less.


More information about the Digitalmars-d mailing list