Jump to page: 1 24  
Page
Thread overview
Proposal: isnot
May 09, 2004
Matthew
May 09, 2004
Matthew
May 09, 2004
Andrew Edwards
May 09, 2004
Matthew
May 10, 2004
Bruno A. Costa
May 22, 2004
Kris
May 09, 2004
Hauke Duden
May 09, 2004
Mike Swieton
May 09, 2004
Mr. Negative
May 09, 2004
Mike Swieton
May 09, 2004
Walter
May 10, 2004
J C Calvarese
May 10, 2004
Helmut Leitner
May 10, 2004
Hauke Duden
May 11, 2004
Helmut Leitner
May 11, 2004
Juan C
May 12, 2004
James McComb
May 12, 2004
J Anderson
May 12, 2004
James McComb
May 12, 2004
J Anderson
May 12, 2004
Derek Parnell
May 12, 2004
James McComb
May 09, 2004
Tu Nam
May 11, 2004
JamesMcComb
May 11, 2004
J Anderson
May 11, 2004
J C Calvarese
May 11, 2004
Phill
May 11, 2004
Phill
May 09, 2004
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
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
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.

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

> "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
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 agree. It's not a critical issue, but having something like isnot would certainly improve readability (even if it sounds like a new kind of tissue that was designed by Apple ;)). D already has too many round parentheses in complex expressions anyway, even more than C++ because they are also used for templates. Getting rid of some of them will certainly be an improvement.

Besides, not having a negative version of "is" is inconsistent, since == also has one.

Hauke
May 09, 2004
On Sun, 09 May 2004 16:18:01 +0300, 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'll throw in a vote for this. If === has !==, then is should have isnot. It would be more consistent.

Mike Swieton
__
Dare to be naive.
	- Buckminster Fuller

May 09, 2004
<snip>
>I'll throw in a vote for this. If === has !==, then is should have isnot. It would be more consistent.
</snip>

I'd rather get rid of "is" and have === and !== . The fewer "English" items in the language the better.


May 09, 2004
On Sun, 09 May 2004 17:22:56 +0000, Mr.Negative wrote:
> I'd rather get rid of "is" and have === and !== . The fewer "English" items in the language the better.


This is certainly a valid consideration, but I disagree. Firstly, because 'is' is already there. I don't think there's a compelling enough reason to break code by removing it. Secondly, I like the english operators better than their symbol counterparts mostly because I think === gets a bit excessive. I understand the use of == over =, but I think that three equals characters is excessive. It is asking for bugs from typos, because it's misuse cannot be detected by the compiler.

Do I think it's a big issue? No. But I think it is a big enough one to warrant inclusion, seeing as how it is a small change.

Mike Swieton
__
If the government wants us to respect the law, they should set a better
example.

May 09, 2004
"Mike Swieton" <mike@swieton.net> wrote in message news:pan.2004.05.09.17.38.26.464217@swieton.net...
> On Sun, 09 May 2004 17:22:56 +0000, Mr.Negative wrote:
> > I'd rather get rid of "is" and have === and !== . The fewer "English"
items in
> > the language the better.
>
>
> This is certainly a valid consideration, but I disagree. Firstly, because
'is'
> is already there. I don't think there's a compelling enough reason to
break
> code by removing it. Secondly, I like the english operators better than
their
> symbol counterparts mostly because I think === gets a bit excessive. I understand the use of == over =, but I think that three equals characters
is
> excessive. It is asking for bugs from typos, because it's misuse cannot be detected by the compiler.
>
> Do I think it's a big issue? No. But I think it is a big enough one to
warrant
> inclusion, seeing as how it is a small change.
>
> Mike Swieton
> __
> If the government wants us to respect the law, they should set a better
> example.
>

It is very easy to make a mistake with '===' and '=='. After lots of D typing, I found out that I should not use '==='; I should always use 'is', because it is much clearer that I check for identity.

It is not a big issue. I think Walter will spend about 10 minutes to incorporate this into the language. But it will save developers lots of time, otherwise spent in tracking down silly typing mistakes.



May 09, 2004
"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
?

It is a small change and easilly done, but once made, we're stuck with it. I'd like to run with the current scheme for a while longer first.


« First   ‹ Prev
1 2 3 4