[OT] Re: The Is Operator

Robert Fraser fraserofhenight at gmail.com
Wed Oct 3 00:23:02 PDT 2007


Chris Nicholson-Sauls Wrote:

> Derek Parnell wrote:
> > On Tue, 02 Oct 2007 17:23:48 -0400, Kyle G. wrote:
> > 
> >> The code I am concerned about is "var !is null" which appears to 
> >> translate to "var not is null" when it actually means "var is not null." 
> >> Is there any special reason why we are unable to do "var isnot null" or 
> >> "var is not null"?
> > 
> > This gets discussed every 6-months or so ... my favourite replacement
> > keyword so far is "aint" as in "if (var aint null) "   :-)
> > 
> > 
> 
> Which reminds me, I need to petition for Ruby to have 'is'/'aint' added to it.  They've 
> already got 'unless' and 'until', so why not?
> 
> -- Chris Nicholson-Sauls

>From some experience in Perl, I can say unless(P) is slightly clearer than if(!P) and until(P) is slightly clearer than while(!P) ... in most cases. I'm not arguing it should be added to D (esp. since if there are multiple ways to express something, stuff can get confusing), but they _do_ make code just that much easier to read.

On that note, I'm also a slight fan of the postfix notation for simple ifs (i.e. something like "a = b if b;" or "file.read() while file.hasMoreBytes();"), but it makes parsing a *****.



More information about the Digitalmars-d mailing list