May 02, 2005 Re: Please may we have an isnot? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | In article <d55c5p$1pk7$1@digitaldaemon.com>, Ben Hinkle says... > > > In some sense it's a pity === didn't stay around since What do you mean? I think I use === every here. Does it fails to compile? (I don't have D here) Ant |
May 02, 2005 Re: Please may we have an isnot? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | "Ant" <Ant_member@pathlink.com> wrote in message news:d55e56$1rs6$1@digitaldaemon.com... > In article <d55c5p$1pk7$1@digitaldaemon.com>, Ben Hinkle says... >> >> >> In some sense it's a pity === didn't stay around since > > What do you mean? > I think I use === every here. > Does it fails to compile? (I don't have D here) I had the feeling it was going to fail to compile at some point but maybe not. I can't remember the details. I notice the spec doesn't mention === or !== anywhere. It says to use !(x is y). |
May 02, 2005 Re: Please may we have an isnot? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | Ant wrote:
> In article <d5597d$1m7r$1@digitaldaemon.com>, SeeSchloss says...
>
>>>>> assert(!(field2 is field));
>>>
>>>Postin' "me too" like some braindead AOLer. =D
>>
>>Just to say I agree such an operator would be nice, though "!is" would be fine
>>as well (and look less strange than "isnot" imho).
>
>
> we could also have "!in" that would be consistent with "!is"
>
> Ant
>
>
Well, what about inout, hmmmm?
-Jake
|
May 02, 2005 Re: Please may we have an isnot? | ||||
---|---|---|---|---|
| ||||
Posted in reply to news.digitalmars.com | news.digitalmars.com wrote:
> Ant wrote:
>
>> In article <d5597d$1m7r$1@digitaldaemon.com>, SeeSchloss says...
>>
>>>>>> assert(!(field2 is field));
>>>>
>>>>
>>>> Postin' "me too" like some braindead AOLer. =D
>>>
>>>
>>> Just to say I agree such an operator would be nice, though "!is" would be fine
>>> as well (and look less strange than "isnot" imho).
>>
>>
>>
>> we could also have "!in" that would be consistent with "!is"
>>
>> Ant
>>
>>
>
> Well, what about inout, hmmmm?
>
> -Jake
I just love clients that "assume" things about "naming" and such.. sheesh!!!
-Jake
|
May 02, 2005 Re: Please may we have an isnot? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Matthew wrote:
> Let me add my plaintiff plea, based on current practical pain for lack of isnot operator.
>
> assert(!(field2 is field));
>
> is just so awkward to write, and ugly to read.
>
>
>
>
I agree, but "isnot" sounds too much like pascal, I prefer something like "!is" or "is!"
|
May 02, 2005 Re: Please may we have an isnot? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jake Oursland | In article <d55r5u$29qo$1@digitaldaemon.com>, Jake Oursland says... > >news.digitalmars.com wrote: >> Ant wrote: >> >>> In article <d5597d$1m7r$1@digitaldaemon.com>, SeeSchloss says... >>> >>>>>>> assert(!(field2 is field)); >>>>> >>>>> >>>>> Postin' "me too" like some braindead AOLer. =D >>>> >>>> >>>> Just to say I agree such an operator would be nice, though "!is" >>>> would be fine >>>> as well (and look less strange than "isnot" imho). >>> >>> >>> >>> we could also have "!in" that would be consistent with "!is" >>> >>> Ant >>> >>> >> >> Well, what about inout, hmmmm? >> I don't understand what you mean. > >I just love clients that "assume" things about "naming" and such.. sheesh!!! > I don't understand what you mean. I was thinking 'in' AA. Does it make sence to have '!in' AA? Ant |
May 02, 2005 Re: Please may we have an isnot? | ||||
---|---|---|---|---|
| ||||
Posted in reply to news.digitalmars.com | On Mon, 02 May 2005 09:53:16 -0600, Jake wrote: > Ant wrote: [snip] >> we could also have "!in" that would be consistent with "!is" > Well, what about inout, hmmmm? LOL... Yes there are not too many operators that are a combination of letters *and* punctuation. It's usually either all punctuation characters or all letters. However, an single operator that indicates the negative of the 'in' operator would be very, very, convenient. Just another thing to make code more legible and enjoyable to write. -- Derek Parnell Melbourne, Australia http://www.dsource.org/projects/build 3/05/2005 7:14:20 AM |
May 03, 2005 Re: Please may we have an isnot? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Matthew wrote: > Let me add my plaintiff plea, based on current practical pain for lack of isnot operator. > > assert(!(field2 is field)); > > is just so awkward to write, and ugly to read. Who is this "plea" directed to ? Walter ? Better try email, then. The rest of us ? Already done... (as it was added to DMD 0.111) http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/14705 Or if in a tight spot I guess you could start writing "isnot" and preprocess it ? Maybe even use cpp: #define isnot !== :-) But I was starting to learn towards "isnt" for the token, myself... --anders |
May 03, 2005 Re: Please may we have an isnot? | ||||
---|---|---|---|---|
| ||||
Posted in reply to zwang | zwang wrote:
> Besides "isnot", a "notin" operator would also be nice.
What would a "notin" operator return ? The current "in"
returns a pointer to the value, or null if is not found.
Identity and not-identity are much easier to "not", as
would a "in" operator that returned a boolean value...
But with the current in operator ? I guess it would be :
((key in hash) == null)
Yes, that is == and not === since "in" uses pointers and
not references. It's a very confusing concept, in itself.
I liked the old double-lookup in operator better, myself.
(i.e. the one that returned a "bit" value, not a pointer)
--anders
|
May 03, 2005 Re: Please may we have an isnot? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders F Björklund | On Tue, 03 May 2005 08:55:59 +0200, Anders F Björklund wrote: > zwang wrote: > >> Besides "isnot", a "notin" operator would also be nice. > > What would a "notin" operator return ? The current "in" returns a pointer to the value, or null if is not found. > > Identity and not-identity are much easier to "not", as would a "in" operator that returned a boolean value... > > But with the current in operator ? I guess it would be : > ((key in hash) == null) > > Yes, that is == and not === since "in" uses pointers and not references. It's a very confusing concept, in itself. > > I liked the old double-lookup in operator better, myself. (i.e. the one that returned a "bit" value, not a pointer) I must admit that I never use the pointer returned by 'in' except to see if it is null or not. I seem to always use this idiom ... if (X in Y) Z = Y[X]; else Z = whatever; and if (X in Y != null) Y[X] = value; Am I doing this the hard way? Am I over cautious? -- Derek Parnell Melbourne, Australia 3/05/2005 7:23:57 PM |
Copyright © 1999-2021 by the D Language Foundation