Look and think good things about D

Chris wendlec at tcd.ie
Fri Nov 15 07:32:23 PST 2013


On Friday, 15 November 2013 at 15:20:20 UTC, Ary Borenszweig 
wrote:
> On 11/15/13 11:39 AM, Chris wrote:
>> Well, that was exactly my point. As a human being you don't 
>> need the
>> patronizing (and highly annoying) "for every number ...". This 
>> is what
>> you say when you explain it to a newbie. But there is no need 
>> to spell
>> this out in the syntax. Syntax of programming languages is (or 
>> should
>> be) like road signs, or any other signs. Concise and 
>> expressive. Else,
>> what's the point? I know that languages like Lua have the 
>> philosophy
>> that non-programmers should be able to use it. But every human 
>> being is
>> capable of abstracting things. There is no need for this 
>> terrible syntax
>>
>> (2..max).each do:
>>
>> end
>
> No need to do that. You can, if you want to. I would have done:
>
> 2.upto(max) do
>   ...
> end
>
>>
>> It doesn't add anything to the code except for useless 
>> characters.
>
> What do you mean by useless characters? How do you do it in D?

I prefer the C style syntax:

foreach (whatever) {
   // ...
} // closes block

All this "end" stuff is superfluous, but at least it closes 
blocks. My pet hate as far as syntax is concerned is Python. The 
indentation (t)error. Change, copy paste > run: Indentation error 
on line ... WTF?! In C style it doesn't matter if you have

if (a > b) { return; }

if (a > b) {
   return;
}

if (a > b)
{
return;
}

or in loops

     foreach (i; array) {
if (i == "Hello!") { break; }
     }

Cleaning up indentation is the programmer's business not the 
language's.


More information about the Digitalmars-d mailing list