May 11, 2004
J Anderson wrote:
> 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.
> 

I reckon that the parsin' would be all mussed up by that.

-- 
Justin (a/k/a jcc7)
http://jcc_7.tripod.com/d/
May 11, 2004
Hauke Duden wrote:
> Helmut Leitner wrote:
> 
>>
>> "Unknown W. Brackets" wrote:
>>
>>>        a === null
>>>        a !== null
>>>        a === b
>>>        a !== b

Heh, I did?

>>
>>
>>
>> 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.
>>

I agree, if someone must have their ugly code they can.  D doesn't stop that, nor does any other language.  I like studlyCaps myself though.

> 
> 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

No, not at all.  I read it as, "if they are freako VB programmers they can write hateful looking code... no reason to punish us all with ugly code for just the poor VB'ers" except not in those words or probably even exact meaning.

-[Unknown]
May 11, 2004
JamesMcComb wrote:

> +1 for this proposal if the operator becomes ain't.
> 
> Example:
> if(a ain't b) // etc..
> 
> James McComb

I concur.

+1

-[Unknown]
May 11, 2004
"J C Calvarese" <jcc7@cox.net> wrote in message news:c7pkr1$23lg$1@digitaldaemon.com...
> J Anderson wrote:
> > 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.
> >
>
> I reckon that the parsin' would be all mussed up by that.

LOL





May 11, 2004
"JamesMcComb" <alan@jamesmccomb.id.au> wrote in message news:c7ph9t$1u2a$1@digitaldaemon.com...
> 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..
>

Are you an Aussie? LOL

You might not believe this, but I was going to reply
to Mathews post with this same suggestion the other day.

Phill.


May 11, 2004

"Unknown W. Brackets" wrote:
> >> 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)
...
> >>
> >> Best done as part of the standard library.
> >>
> 
> I agree, if someone must have their ugly code they can.

You don't know what you are talking about.
Function call syntax isn't more or less ugly than operator syntax.
Is {/} uglier than begin/end? Is != uglier than <>?
You just get have to get used to it, that's all.
Important is: to be able to do your job with a minimum of complexity.

-- 
Helmut Leitner    leitner@hls.via.at
Graz, Austria   www.hls-software.com
May 11, 2004
If == is for testing the contents and === is for testing the address, then "is" shouldn't be one of those -- oh wouldn't it be neat if "is" were used to test the type of the item:  if ( x is int ) ...

I don't think an operator that's for testing for one special situation is very useful, I would prefer a property:  MyRef.IsNull


May 12, 2004
Juan C wrote:

> I don't think an operator that's for testing for one special situation is very
> useful, I would prefer a property:  MyRef.IsNull

This IsNull property idea intrigues me (no foolin', this time).
But it should probably be isNull, rather than IsNull.

It could be defined for all object references.

Example:

/* x is an object reference */
if (!x.isNull) { //etc.. }

What do you think?

James McComb
May 12, 2004
James McComb wrote:

> Juan C wrote:
>
>> I don't think an operator that's for testing for one special situation is very
>> useful, I would prefer a property:  MyRef.IsNull
>
>
> This IsNull property idea intrigues me (no foolin', this time).
> But it should probably be isNull, rather than IsNull.
>
> It could be defined for all object references.
>
> Example:
>
> /* x is an object reference */
> if (!x.isNull) { //etc.. }
>
> What do you think?
>
> James McComb

Might as well define your own function to do it:

if (!isNull(x))

-- 
-Anderson: http://badmama.com.au/~anderson/
May 12, 2004
J Anderson wrote:

> Might as well define your own function to do it:
> 
> if (!isNull(x))
> 

Sure, you could that.

But isNull is a function that

a. is used extremely often
b. is well-defined for all references.

If there was an isNull property, I'd use it.
Otherwise !== is fine by me.

James McComb