Omittable parens is an evil

Nick Sabalausky a at a.a
Sat Jul 19 16:35:07 PDT 2008


"Manfred_Nowak" <svv1999 at hotmail.com> wrote in message 
news:g5tmqq$b99$2 at digitalmars.com...
> Mike wrote:
>
>> "this does something" (parens) and "this is data" (no parens)
>
> Compare this with this extract of your other posting:
>>  opAddAssign(auto value) { _bar += value; }
>>                // it's extremely extendable!
>
> Yes it is extremely extentable because one can incorporate calls to
> some arbitrary functions into the body of `opAddAssign':
>
>   opAddAssign(auto value) {
>     _bar += value;
>     action();
>     procedure();
>   }
>
> ... bang!!! Your "clear _VISUAL_ distinction" has been lost.
>
> -manfred
>

When looking at code that accesses a property or uses an operator that is 
overloadable, you don't usually need to know if extra processing is going on 
behind-the-scenes (typically only when optimizing). But when looking at code 
that involves a function, the distrinction between "invoked"/"not invoked" 
is almost always (if not always) a very important make-or-break matter.





More information about the Digitalmars-d mailing list