October 02, 2007
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
October 02, 2007
Gregor Richards wrote:
> 0ffh wrote:
> 
>> 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"?
>>
>>
>> I think the syntax is perfectly logical, because the negation applies to
>> the /operator/ and not the /operand/.Note the analogy of the statements:
>>
>>   (p == null)  <-->  (p is null)
>>   (p != null)  <-->  (p !is null)
>>
>> Nobody would ever get try to write (i == !null), so why (i is not null)?
>>
>> Regards, Frank
> 
> 
> Yeah, to me "a is not null" makes sense as an English sentence, but as an operator it seems like "a is (not null)". (not null) would have to evaluate to ... 1? So this would be a is 1, which isn't what we want at all.
> 
> Suffice to say D !is English.
> 
>  - Gregor Richards

I'd like to point out that "is not" is exactly what the Python equivalent of "!is" is.

http://docs.python.org/ref/comparisons.html

if a is not None:
    foo()

Likewise, it also uses "not in".

-- 
Kirk McDonald
http://kirkmcdonald.blogspot.com
Pyd: Connecting D and Python
http://pyd.dsource.org
October 02, 2007
Kirk McDonald wrote:
> Gregor Richards wrote:
>> 0ffh wrote:
>>
>>> 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"?
>>>
>>>
>>> I think the syntax is perfectly logical, because the negation applies to
>>> the /operator/ and not the /operand/.Note the analogy of the statements:
>>>
>>>   (p == null)  <-->  (p is null)
>>>   (p != null)  <-->  (p !is null)
>>>
>>> Nobody would ever get try to write (i == !null), so why (i is not null)?
>>>
>>> Regards, Frank
>>
>>
>> Yeah, to me "a is not null" makes sense as an English sentence, but as an operator it seems like "a is (not null)". (not null) would have to evaluate to ... 1? So this would be a is 1, which isn't what we want at all.
>>
>> Suffice to say D !is English.
>>
>>  - Gregor Richards
> 
> I'd like to point out that "is not" is exactly what the Python equivalent of "!is" is.
> 
> http://docs.python.org/ref/comparisons.html
> 
> if a is not None:
>     foo()
> 
> Likewise, it also uses "not in".

And also the binary boolean operators 'and' and 'or'.

   if you is not None and I is not finished or they is happy:
        goto_skool()

See reads just like English!

--bb
October 03, 2007
Walter Bright wrote:
> Kyle G. wrote:
>> Is there any special reason why we are unable to do "var isnot null" or "var is not null"?
> 
> It all depends on what the meaning of "is" is.

That's a good quote to go with your collection of famous things nobody ever said about D.  You can attribute it to Dill Dinton.

--bb, hoping you don't take this suggestion seriously.
October 03, 2007
Kirk McDonald wrote:
> I'd like to point out that "is not" is exactly what the Python equivalent of "!is" is.
> [...]
> Likewise, it also uses "not in".

Well, "not in" seems okay but "is not" looks.... like wierd!
Let "not" be a prefix, and a prefix always, lest you flummox the coder! :)

Regards, Frank

October 03, 2007
Walter Bright wrote:
> Kyle G. wrote:
>> Is there any special reason why we are unable to do "var isnot null" or "var is not null"?
> 
> It all depends on what the meaning of "is" is.

That sounds like quote from a US politician.

And so without 'is,' ...

In this context, the first 'is' attempts to discern whether their exists a known accepted justification for the usage of "!is" as opposed to something potentially cleaner and easier to read.

It appears the justification which has been applied here follows that an extra keyword in the language would not be necessary when existing language keywords suffice.
October 03, 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 *****.
October 03, 2007
Derek Parnell wrote:
> This gets discussed every 6-months or so ... my favourite replacement
> keyword so far is "aint" as in "if (var aint null) "   :-)

I vote for if (var uint null) !
October 03, 2007
Alexander Panek wrote:

>> This gets discussed every 6-months or so ... my favourite replacement
>> keyword so far is "aint" as in "if (var aint null) "   :-)
> 
> I vote for if (var uint null) !

I thought the "if (var out null)" was somewhat amusing too...

--anders
October 03, 2007
Bill Baxter wrote:
>    if you is not None and I is not finished or they is happy:
>         goto_skool()
> 
> See reads just like English!
> 
> --bb

It took me a moment to realize this can be valid code. Perhaps it is the lack of syntax highlighting, but as code, it is hard to read for me.