May 09, 2004 Re: Proposal: isnot | ||||
---|---|---|---|---|
| ||||
Posted in reply to resistor AT nospam DOT mac DOT com | > As I recall, the specification seems to imply (incorrectly?) that one must > always compare against null > with the 'is' operator. Is this incorrect? If so, I think we may need to > reexamine the spec because it > seems like a certain percentage of people are misreading it. If that is so, then I am certainly one making such a mistake > Owen > > In article <c7lcfs$1ugj$1@digitaldaemon.com>, Matthew says... > > > >What's wrong with > > > > if(null !== foo) > > > >? > > > >"Achilleas Margaritis" <axilmar@b-online.gr> wrote in message news:c7lb26$1skj$1@digitaldaemon.com... > >> I am currently writing some GUI application with D, and I found it is tiresome and errorprone to write !(foo is null) all the time. I think D would benefit from an 'isnot' operator. If it existed, I could write 'foo isnot null' and be more productive, since it is easy to forget the ! and makes the code more beautiful since less parentheses are needed. > >> > >> It is a small change, easily done in my opinion. What do you think, Walter ? > >> > >> > >> > > > > > > |
May 09, 2004 Re: Proposal: isnot | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrew Edwards | > Matthew wrote: > > What's wrong with > > > > if(null !== foo) > > > > ? > > I'd say the same thing that's wrong with > > if(foo === null) // as opposed to if(foo is null) > > Absolutely nothing! Except that it is clearer and less errorprone. > Quite frankly I don't see much of a problem with the proposal. > Of course I'm not the one engineering this beast, so I'll > leave it up to the big boys to decide. No, I don't see much wrong either. Was just being orthogonal. However, I don't like isnot. I'd prefer "is not". I'd also like to be able to use "not" with "in" for searching containers. > > > "Achilleas Margaritis" <axilmar@b-online.gr> wrote in message news:c7lb26$1skj$1@digitaldaemon.com... > > > >>I am currently writing some GUI application with D, and I found it is tiresome and errorprone to write !(foo is null) all the time. I think D would benefit from an 'isnot' operator. If it existed, I could write 'foo isnot null' and be more productive, since it is easy to forget the ! and makes the code more beautiful since less parentheses are needed. > >> > >>It is a small change, easily done in my opinion. What do you think, Walter ? > >> |
May 09, 2004 Re: Proposal: isnot | ||||
---|---|---|---|---|
| ||||
Posted in reply to Achilleas Margaritis | Achilleas Margaritis wrote:
> I am currently writing some GUI application with D, and I found it is
> tiresome and errorprone to write !(foo is null) all the time. I think D
> would benefit from an 'isnot' operator. If it existed, I could write 'foo
> isnot null' and be more productive, since it is easy to forget the ! and
> makes the code more beautiful since less parentheses are needed.
>
> It is a small change, easily done in my opinion. What do you think, Walter ?
>
>
>
I would prefer:
a !is b
And:
a !== b
But that's just my personal opinion.
-[Unknown]
|
May 09, 2004 Re: Proposal: isnot | ||||
---|---|---|---|---|
| ||||
Posted in reply to Achilleas Margaritis | Well so D will become DASIC , not just D. Basic has them all . Is , Not , TypeOf etc ... I don't think we would implement more English word in a programming language , let's it has something common for everyone . != and == are good . If we want code more clean , why don't we implement isEqual() and notEqual() in our object "Achilleas Margaritis" <axilmar@b-online.gr> wrote in message news:c7lb26$1skj$1@digitaldaemon.com... > I am currently writing some GUI application with D, and I found it is tiresome and errorprone to write !(foo is null) all the time. I think D would benefit from an 'isnot' operator. If it existed, I could write 'foo isnot null' and be more productive, since it is easy to forget the ! and makes the code more beautiful since less parentheses are needed. > > It is a small change, easily done in my opinion. What do you think, Walter ? > > > |
May 10, 2004 Re: Proposal: isnot | ||||
---|---|---|---|---|
| ||||
Posted in reply to Unknown W. Brackets | Unknown W. Brackets wrote: > Achilleas Margaritis wrote: > >> I am currently writing some GUI application with D, and I found it is >> tiresome and errorprone to write !(foo is null) all the time. I think D >> would benefit from an 'isnot' operator. If it existed, I could write 'foo >> isnot null' and be more productive, since it is easy to forget the ! and >> makes the code more beautiful since less parentheses are needed. >> >> It is a small change, easily done in my opinion. What do you think, Walter ? >> >> >> > > I would prefer: > > a !is b I like that. > > And: > > a !== b I don't like that so much (especially not "==="). But they're a whole bunch more consistant with D than "isnot" or "not is". I like BASIC okay, but I don't want D to morph into BASIC. > > But that's just my personal opinion. > > -[Unknown] -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/ |
May 10, 2004 Re: Proposal: isnot | ||||
---|---|---|---|---|
| ||||
Posted in reply to Unknown W. Brackets | "Unknown W. Brackets" wrote: > a === null > a !== null > a === b > a !== b If I would dislike such things (which I don't) then I would write the equivalent of C macros (D functions optimized away): IsNull(a) NotNull(a) PtrEqu(a,b) PtrCmp(a,b) Best done as part of the standard library. -- Helmut Leitner leitner@hls.via.at Graz, Austria www.hls-software.com |
May 10, 2004 Re: Proposal: isnot | ||||
---|---|---|---|---|
| ||||
Posted in reply to Helmut Leitner | Helmut Leitner wrote:
>
> "Unknown W. Brackets" wrote:
>
>> a === null
>> a !== null
>> a === b
>> a !== b
>
>
> If I would dislike such things (which I don't) then I would
> write the equivalent of C macros (D functions optimized away):
>
> IsNull(a)
> NotNull(a)
> PtrEqu(a,b)
> PtrCmp(a,b)
>
> Best done as part of the standard library.
>
Urgh! You propose that the built-in syntax should not be used and one should have to create functions for these most basic operations? I would much rather have the normal syntax be readable and not rely on a library to fix a design fault.
I also don't think that PtrEqu(a,b) is particularly well readable. The Windows API does this kind of thing a lot and IMHO this is merely the lesser of two evils in most cases. Better use the good solution while you still can.
Hauke
|
May 10, 2004 Re: Proposal: isnot | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Matthew wrote:
>
> However, I don't like isnot. I'd prefer "is not".
>
> I'd also like to be able to use "not" with "in" for searching containers.
>
Agreed. I didn't like the "isnot" operator. "is not" is much better, IMHO.
Bruno.
|
May 11, 2004 Re: Proposal: isnot | ||||
---|---|---|---|---|
| ||||
Posted in reply to Achilleas Margaritis | Achilleas Margaritis wrote:
> I am currently writing some GUI application with D, and I found it is
> tiresome and errorprone to write !(foo is null) all the time. I think D
> would benefit from an 'isnot' operator. If it existed, I could write 'foo
> isnot null' and be more productive, since it is easy to forget the ! and
> makes the code more beautiful since less parentheses are needed.
+1 for this proposal if the operator becomes ain't.
Example:
if(a ain't b) // etc..
James McComb
|
May 11, 2004 Re: Proposal: isnot | ||||
---|---|---|---|---|
| ||||
Posted in reply to JamesMcComb | JamesMcComb wrote: > Achilleas Margaritis wrote: > >> I am currently writing some GUI application with D, and I found it is >> tiresome and errorprone to write !(foo is null) all the time. I think D >> would benefit from an 'isnot' operator. If it existed, I could write 'foo >> isnot null' and be more productive, since it is easy to forget the ! and >> makes the code more beautiful since less parentheses are needed. > > > +1 for this proposal if the operator becomes ain't. > > Example: > if(a ain't b) // etc.. > > James McComb Is this a joke? The ' would cause also kinds of parsing errors. -- -Anderson: http://badmama.com.au/~anderson/ |
Copyright © 1999-2021 by the D Language Foundation