Thread overview | |||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 23, 2004 !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
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 Matthew | >Matthew wrote:
> 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?
I agree. Having to add an extra layer of perens just to use 'is' in these situations seems silly. Whichever of the above would be easier to parse has my vote.
Sean
|
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | 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.
>
> 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?
Please! 'not in' and unary 'not' would be nice too.
The price we pay, having an operator with embedded whitespace, seems well worth the trouble for having syntax which is self-evident to anybody, whether or not they have even heard of the language.
-- andy
|
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | On Fri, 23 Jul 2004 11:27:44 +1000, 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? Too obvious! For our younger coders this really should be "(hkey is null) not!" ;-) Joking aside, this is a reasonable suggestion, if only for consistancy sake. I think I prefer the "is not" over "isnot". Readability should be one of the goals for a programming language. -- Derek Melbourne, Australia 23/Jul/04 11:52:58 AM |
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | 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) <g> (forgive me if I attributed that beauty to the wrong person) "Matthew" <admin.hat@stlsoft.dot.org> wrote in message news:cdppih$1ab1$1@digitaldaemon.com... > 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 wrote: > if (x AINT null) Hey! I already made that suggestion! > (forgive me if I attributed that beauty to the wrong person) You are forgiven. ;) Just to confuse the parser even more, my suggested ain't keyword has an apostrophe in it. 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) > > <g> > > (forgive me if I attributed that beauty to the wrong person) I don't think that was me... but I like it, too ;-) > > "Matthew" <admin.hat@stlsoft.dot.org> wrote in message news:cdppih$1ab1$1@digitaldaemon.com... >> 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 isnot, yousnot, we all snot for isnot >> >> (ii) forget about is for testing null-ness. >> >> Thoughts? >> >> >> >> |
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Matthew wrote:
> (i) we have the keyword modifier "not", as in "hkey is not null", or have an isnot keyword, as in "hkey isnot null", or
+1 for the isnot keyword as a direct replacement for !==.
Please don't introduce a separate not keyword, because newbies will be confused about when they should and shouldn't use it. For example, which of the following should be legal:
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.
James McComb
|
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to James McComb | James McComb wrote:
> Matthew wrote:
>
>> (i) we have the keyword modifier "not", as in "hkey is not null", or have an isnot keyword, as in "hkey isnot null", or
>
>
> +1 for the isnot keyword as a direct replacement for !==.
>
> Please don't introduce a separate not keyword, because newbies will be confused about when they should and shouldn't use it. For example, which of the following should be legal:
>
> 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!
-- andy
|
July 23, 2004 Re: !(null is hkey) ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to James McComb | "James McComb" <alan@jamesmccomb.id.au> wrote in message news:cdptfp$1but$1@digitaldaemon.com... > Matthew wrote: > > > (i) we have the keyword modifier "not", as in "hkey is not null", or have an isnot keyword, as in "hkey isnot null", or > > +1 for the isnot keyword as a direct replacement for !==. > > Please don't introduce a separate not keyword, because newbies will be confused about when they should and shouldn't use it. For example, which of the following should be legal: > > a. if (a is not null) Only this one. If not is a separate word, and is a keyword modifier, it'd only be in concert with is. For me, though, I would rather it be isnot, as this cuts down on the parsing hassles > b. if (a not is null) > c. if not (a is null) etc. > > isnot has less potential for confusion. > > James McComb |
Copyright © 1999-2021 by the D Language Foundation