Is str ~ regex the root of all evil, or the leaf of all good?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Thu Feb 19 10:07:30 PST 2009
Ary Borenszweig wrote:
> bearophile wrote:
>> Jarrett Billingsley:
>>
>> This is an old discussion, and maybe it will not lead to much.
>>
>>
>>> If you don't have a semicolon, you get a simple parser error. That is
>>> not a bug.<
>>
>> Wikipedia agrees with me:
>>
>> http://en.wikipedia.org/wiki/Software_bug
>>> A software bug is an error, flaw, mistake, failure, or fault in a
>>> computer program that prevents it from behaving as intended (e.g.,
>>> producing an incorrect or unexpected result).<
>>
>> So a parser error is a bug too, despite the compiler will help you
>> find it in a moment.
>>
>> I have written and debugged many times "mistakes" like:
>>
>> foreach (a, b, iterable)
>> foreach (a; b; iterable)
>> foreach (a; b, iterable)
>>
>> And probably I am not the only one :-)
>
> Why would you do that?
>
> Many times when writing C# loops I do foreach(x; ...) and then remember
> it's "in" in C#, because I'm used to writing ";" in Java. I prefer ";"
> because it's shorter and you write a lot of foreach loops in a program.
>
> Maybe we should vote and see how many people make the mistake of
> confusing comma and semicolon in this case.
Not confusing me. I'll note that if "in" were used, you could write:
foreach (a in b in c) {}
Now try explaining that one :o).
Andrei
More information about the Digitalmars-d
mailing list