Changing the behavior of the comma operator

monarch_dodra monarchdodra at gmail.com
Wed Mar 26 04:13:31 PDT 2014


On Wednesday, 26 March 2014 at 11:08:45 UTC, Andrej Mitrovic 
wrote:
> On 3/26/14, Kagamin <spam at here.lot> wrote:
>> On Tuesday, 25 March 2014 at 17:58:45 UTC, bearophile wrote:
>>> I think total removal of the comma operator could offer more
>>> readable D code.
>>
>> No, complete removal will make code less readable. Why can't 
>> you
>> read commas?
>
> Have you never experienced this bug before?
>
> enum vals = [
>     "afoo01foo01",
>     "bbar02foo02",
>     "cdoo03foo03",
>     "dfoo01foo04",
>     "ebar02foo01",
>     "fdoo03foo02",
>     "gfoo01foo03",
>     "hbar02foo04",
>     "aidoo03foo01"
>     "jfoo01foo02a",
>     "kbar02foo03",
>     "ldoo03foo04",
> ];
>
> This has nothing to do with the comma operator, but what it has 
> to do
> is with readability. The comma is easily misplaced.

I experienced it this very morning, testing your getopt code :/

Forgot to place the parens at all :
string[] args = ["myProgram.exe" "--users" "foo" "bar"];

I know the code is wrong, but there's something that seriously 
pisses me off about code that compiles anyways, then does weird 
stuff.

Implicit string concatenation brings *no* "functional" gains, but 
*is* a source of bugs. That should also killed with extreme 
prejudice.


More information about the Digitalmars-d mailing list