shouting versus dotting

Steven Schveighoffer schveiguy at yahoo.com
Mon Oct 6 08:53:16 PDT 2008


"Andrei Alexandrescu" wrote
> Steven Schveighoffer wrote:
>>
>> I find the {} much easier to read than the . syntax.
>
> To me too.
>
>> The omitting of the braces is not a huge savings.  You are sacrificing a 
>> couple characters, actually only one if you are comparing @ with {}, at 
>> the expense of clarity.  I think it's a special case that is not really 
>> worth the trouble.  Besides, it's not hard to type {} when you are so 
>> used to it anyways, and if you are interested in saving characters, 
>> aliasing is a much better approach.
>
> One thing I kinda dislike about Template at Arg is that adding a second arg 
> also asks for the parens. This is a problem present with single- vs. 
> multi-statement blocks as well:
>
> if (a)
>     b;
>
> If you want to add another statement, you need to add the curls as well:
>
> if (a)
> {
>     b;
>     c;
> }
>
> But then if you want to remove one of the statement you'd want to remove 
> the curls too to stay consistent:
>
> if (a)
>     c;
>
> This becomes tenuous enough that many people and some coding standards 
> actually prefer to use full block statements to start with, even when they 
> only contain one statement.

Yeah, I find myself doing that also, removing the {} braces when possible, 
but that can't apply here for technical reasons.

Conversely, I don't think anyone is complaining that they always have to use 
braces for one-line functions.

>> One thing I should mention, since this is all about asthetics, my news 
>> reader keeps treating the name at param as a linked email address.  Somthing 
>> that will be very annoying if we adopt the @ syntax and end up discussing 
>> templates on the NG.
>
> Walter made another point, namely that "@" has "a lot of ink" in it. I 
> know what he means. I guess people who wanted templates to be 
> distinguished will find that an advantage :o).

Yeah, but ! is just as good then, and we don't have to change thousands of 
lines of code ;)

>
>> I still vote to keep ! as it's the easiest solution, and I never have 
>> found it annoying ;)
>
> Well would you go on a strike if there was a little experimentation with 
> the curls?

I like D too much to give it up based on this one thing.  But I would be 
cursing you profusely as I changed all my existing D code when I move to 
support D2.  I don't think I'd ever feel that it was an improvement, but if 
it means so much to everyone to abolish the ! syntax, I'd just do the 
updates and move on.  Like I said, it's a bicycle shed color.

BTW, this would be another notch in the D1/D2 incompatibility belt (perhaps 
an insurmountable one), but that ship may have already sailed.

-Steve 





More information about the Digitalmars-d mailing list