Problem with using && as shorthand for if

Jonathan M Davis jmdavisprog at gmail.com
Fri Aug 20 15:39:05 PDT 2010


On Friday, August 20, 2010 15:32:16 bearophile wrote:
> Jonathan M Davis:
> > Well, Andrei is definitely a fan of using D for small scripts, so
> > arguments that something shouldn't be done because it's intended for
> > scripting aren't going to fly with him. Personally, I find it a bit
> > weird, but I don't really care. I probably won't code that way, but I
> > don't mind that it's an option.
> 
> Even small scripts need to be tidy. And I don't like that stupid shortcut
> in a language that tries to be safe as D. Andrei is wrong here.
> 
> A problem with similar shortcuts is that they save you few chars and they
> look handy, but sometimes they later come back to bite your ass. Perl is a
> good example of this.
> 
> Bye,
> bearophile

It's essentially the same as putting an entire if statement on one line, which 
I'm not a fan of doing, but there are plenty of people who do.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list