Notes IV

Bill Baxter dnewsgroup at billbaxter.com
Fri Jan 25 01:08:46 PST 2008


Jarrod wrote:
> Okay you wrote a lot of stuff, and I generally agree for a lot of it, but 
> I disagree for a few things.
> 
>  
>> 1) In D I often enough do mistekes like this: foreach (i, a, myobj)
>> But usually not this one:
>> foreach (i; a; myobj)
>> There for my eyes it's not always easy to spot the difference between
>> "," and ";", so I think a "in" instead of ";" (as used in Python and C#
>> too) can be seen better: foreach (i, a in myobj)
> 
> I don't really see what this fixes. It seems you just prefer to use 'in' 
> because you're used to python.

It's funny you should say that, because just today I was staring at a 
couple of foreaches that were giving me compiler errors and scratching 
my head.  Turns out I had written this:

      foreach(i,ang, angles) {
          ...
      }

Now maybe you can see right away what's wrong, but in my somewhat sleepy 
state and with my preferred ProggyTT programming font, I just didn't 
notice the missing pixel there.   It's much harder to mistake a comma 
for an 'in'.

> Most people don't like the forced indentation in python and I'm one of 
> those people.

Hmm, that doesn't sound like a scientific study.  Python has many more 
users than D despite the fact that apparently most people don't like it.

That said, I think trying to change such a basic part of D's syntax at 
this point is a bad idea.


--bb



More information about the Digitalmars-d mailing list