July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | Andy Friesen wrote:
>> a. if (a is not null)
>> b. if (a not is null)
>> c. if not (a is null) etc.
>>
>> isnot has less potential for confusion.
>
>
> I highly doubt this would be an issue. Almost everybody is going to do the most obvious that comes to mind: write it out like plain old English.
>
> Unless like Yoda they talk, correct will they be!
Unless with Visual Basic they code:
If Not X Is Nothing Then
If Not IsNull(X) Then
James McComb
|
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kris | Kris wrote:
> Know wot' u mean guv', but "is not" seems a tad verbose, whereas:
>
> if (x not null)
>
> sounds fine to me (D "is not" COBOL :~)
>
> However, I think the best suggestion was put forward by Ben:
>
> if (x AINT null)
That's pure genius :)
Sean
|
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to James McComb | James McComb wrote:
> a. if (a is not null)
> b. if (a not is null)
> c. if not (a is null) etc.
>
> isnot has less potential for confusion.
One of the most important python goal is readability...
Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 1
>>> a is not None
True
>>> a not is None
File "<stdin>", line 1
a not is None
^
SyntaxError: invalid syntax
>>> not (a is None)
True
>>>
---
Paolo Invernizzi
|
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paolo Invernizzi | I agree that "is not" is the most desirable form. I don't think anyone would (seriously) disagree with that. But D is specifically designed to be easy to implement, so I am prepared to go for "isnot" if that makes it acceptable to Walter. "Paolo Invernizzi" <arathorn@NOSPAM_fastwebnet.it> wrote in message news:cdqcds$1j3c$1@digitaldaemon.com... > James McComb wrote: > > > a. if (a is not null) > > b. if (a not is null) > > c. if not (a is null) etc. > > > > isnot has less potential for confusion. > > One of the most important python goal is readability... > > Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> a = 1 > >>> a is not None > True > >>> a not is None > File "<stdin>", line 1 > a not is None > ^ > SyntaxError: invalid syntax > >>> not (a is None) > True > >>> > > --- > Paolo Invernizzi |
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | "Matthew" <admin.hat@stlsoft.dot.org> wrote in message news:cdqeaj$1kjh$1@digitaldaemon.com... > I agree that "is not" is the most desirable form. I don't think anyone would (seriously) disagree with that. But D is > specifically designed to be easy to implement, so I am prepared to go for "isnot" if that makes it acceptable to Walter. What? You don't think Walter would go for "aint" ? D would enter the halls of notoriety overnight! :-) |
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | I agree that !(a is b) is cumbersome.
"is not" would be better. Or maybe something more similar to the normal D syntax?
What about a !is b ?
Matthew wrote:
> While I like the use of is - for one thing, I can reorder the expression to read more naturally, i.e. "hkey is null"
> rather than "null === hkey" - I don't like the need to ! the expression.
>
> Presumably the reason for preferring "is" over "===" is that it reads better, which it does in the === case.
>
> "hkey is null"
>
> is better than
>
> "hkey === null"
>
> But it seems a starkyl retrograde step to have write "!(hkey is null)" instead of "hkey !== null"
>
> "hkey !== null"
>
> is (much!) better than
>
> "!(hkey is null)"
>
> So, if "!(hkey is null)" is not to people's tastes, as I suggest is the case, then we might end up with an inconsistent
> use of "is" for null, and "!==" for not null. That is not good.
>
> I suggest that, either:
>
> (i) we have the keyword modifier "not", as in "hkey is not null", or have an isnot keyword, as in "hkey isnot null", or
>
> (ii) forget about is for testing null-ness.
>
> Thoughts?
>
>
>
>
|
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hauke Duden | Leading on from that Hauke, what about this: if (a ! b) A bit terse perhaps? Maybe conflicts with a template identifier? Might cause issues where an '=' was not typed by mistake? Regardless; is this notion another candidate for an operator overload? "Hauke Duden" <H.NS.Duden@gmx.net> wrote in message news:cdqhnh$1m2l$1@digitaldaemon.com... > I agree that !(a is b) is cumbersome. > > "is not" would be better. Or maybe something more similar to the normal D syntax? > > What about a !is b ? > > > Matthew wrote: > > While I like the use of is - for one thing, I can reorder the expression to read more naturally, i.e. "hkey is null" > > rather than "null === hkey" - I don't like the need to ! the expression. > > > > Presumably the reason for preferring "is" over "===" is that it reads better, which it does in the === case. > > > > "hkey is null" > > > > is better than > > > > "hkey === null" > > > > But it seems a starkyl retrograde step to have write "!(hkey is null)" instead of "hkey !== null" > > > > "hkey !== null" > > > > is (much!) better than > > > > "!(hkey is null)" > > > > So, if "!(hkey is null)" is not to people's tastes, as I suggest is the case, then we might end up with an inconsistent > > use of "is" for null, and "!==" for not null. That is not good. > > > > I suggest that, either: > > > > (i) we have the keyword modifier "not", as in "hkey is not null", or have an isnot keyword, as in "hkey isnot null", or > > > > (ii) forget about is for testing null-ness. > > > > Thoughts? > > > > > > > > |
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hauke Duden | "Hauke Duden" <H.NS.Duden@gmx.net> wrote in message news:cdqhnh$1m2l$1@digitaldaemon.com... > I agree that !(a is b) is cumbersome. > > "is not" would be better. Or maybe something more similar to the normal D syntax? > > What about a !is b ? It's a mix of a word and an operator. I think one or the other is best. Just my opinion > > > Matthew wrote: > > While I like the use of is - for one thing, I can reorder the expression to read more naturally, i.e. "hkey is null" rather than "null === hkey" - I don't like the need to ! the expression. > > > > Presumably the reason for preferring "is" over "===" is that it reads better, which it does in the === case. > > > > "hkey is null" > > > > is better than > > > > "hkey === null" > > > > But it seems a starkyl retrograde step to have write "!(hkey is null)" instead of "hkey !== null" > > > > "hkey !== null" > > > > is (much!) better than > > > > "!(hkey is null)" > > > > So, if "!(hkey is null)" is not to people's tastes, as I suggest is the case, then we might end up with an inconsistent > > use of "is" for null, and "!==" for not null. That is not good. > > > > I suggest that, either: > > > > (i) we have the keyword modifier "not", as in "hkey is not null", or have an isnot keyword, as in "hkey isnot null", or > > > > (ii) forget about is for testing null-ness. > > > > Thoughts? > > > > > > > > |
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kris | "Kris" <someidiot@earthlink.dot.dot.dot.net> wrote in message news:cdqifu$1mcn$1@digitaldaemon.com... > Leading on from that Hauke, what about this: > > if (a ! b) Not obvious enough, sorry > A bit terse perhaps? Maybe conflicts with a template identifier? Might cause issues where an '=' was not typed by mistake? > > Regardless; is this notion another candidate for an operator overload? No > "Hauke Duden" <H.NS.Duden@gmx.net> wrote in message news:cdqhnh$1m2l$1@digitaldaemon.com... > > I agree that !(a is b) is cumbersome. > > > > "is not" would be better. Or maybe something more similar to the normal D syntax? > > > > What about a !is b ? > > > > > > Matthew wrote: > > > While I like the use of is - for one thing, I can reorder the expression > to read more naturally, i.e. "hkey is null" > > > rather than "null === hkey" - I don't like the need to ! the expression. > > > > > > Presumably the reason for preferring "is" over "===" is that it reads > better, which it does in the === case. > > > > > > "hkey is null" > > > > > > is better than > > > > > > "hkey === null" > > > > > > But it seems a starkyl retrograde step to have write "!(hkey is null)" > instead of "hkey !== null" > > > > > > "hkey !== null" > > > > > > is (much!) better than > > > > > > "!(hkey is null)" > > > > > > So, if "!(hkey is null)" is not to people's tastes, as I suggest is the > case, then we might end up with an inconsistent > > > use of "is" for null, and "!==" for not null. That is not good. > > > > > > I suggest that, either: > > > > > > (i) we have the keyword modifier "not", as in "hkey is not null", or > have an isnot keyword, as in "hkey isnot null", or > > > > > > (ii) forget about is for testing null-ness. > > > > > > Thoughts? > > > > > > > > > > > > > > |
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hauke Duden | Hauke Duden schrieb:
> I agree that !(a is b) is cumbersome.
>
> "is not" would be better. Or maybe something more similar to the normal D syntax?
>
> What about a !is b ?
I'd vote for !is!
|
Copyright © 1999-2021 by the D Language Foundation