www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - get rid of === completely

reply B.G. <B.G._member pathlink.com> writes:
I think === is just irritating, it should be entirely removed in favor of
is/isnot.

After another beer it gets nearly impossible to differenciate from ==.
Especially when it stands alone in the code. My programming experience has been
lately enriched by another cool programming-'technique': to understand some code
I'm often fated to count ='s with the cursor and feel myself like an idiot :-)

Just wondering, anyone else having optical troubles like that?
May 02 2005
next sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
B.G. wrote:

 I think === is just irritating, it should be entirely removed in favor of
 is/isnot.
Why must the old ones be removed ? (you can use the new if you like)
 After another beer it gets nearly impossible to differenciate from ==.
 Just wondering, anyone else having optical troubles like that?
I find !== to be more tricky, but then again I likely had fewer beers. --anders
May 02 2005
parent reply Norbert Nemec <Norbert Nemec-online.de> writes:
Anders F Bj=F6rklund schrieb:
 B.G. wrote:
=20
 I think =3D=3D=3D is just irritating, it should be entirely removed in=
favor of
 is/isnot.
=20 Why must the old ones be removed ? (you can use the new if you like)
In general: A good language does not only allow you to write your own=20 code comfortably, but also helps writing code that others can read. Having pointless freedom of choice clutters the language, puts=20 additional burden onto the implementors and the programmers as well.
May 03 2005
next sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Norbert Nemec wrote:

 Why must the old ones be removed ? (you can use the new if you like)
In general: A good language does not only allow you to write your own code comfortably, but also helps writing code that others can read. Having pointless freedom of choice clutters the language, puts additional burden onto the implementors and the programmers as well.
Well, since it's no point of swimming upstream - I can live with "is" and "isnot"/"isnt" instead of the previous "===" and "!==". Good thing I haven't got *that* much D code to change, even if it should be a pretty straight-forward search/replace in this case ? Keyword "is" was added to DMD version 0.76, back in Nov 21, 2003. But it wasn't clear if it was "instead of", or "in addition to" ? This is assuming that the TOKnotidentity *ever* gets a new D token, which is also a point that Matthew raised (again) in another thread. (http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/22855) Since "(!(a is b))" is so ugly, much more so than "(a !== b)" is. Let's hope that DMD 0.122 can put this tiny little issue to rest ? It's trivial enough to add a new keyword, compared to this debate. I happen to like the === and !== operators, but seem rather alone. But if "==" is changed into "equals", I'm heading for the hills... :-) --anders
May 03 2005
parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anders F Björklund schrieb am Tue, 03 May 2005 11:11:08 +0200:
 I happen to like the === and !== operators, but seem rather alone.
 But if "==" is changed into "equals", I'm heading for the hills... :-)
You aren't alone :D Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCd1Cb3w+/yD4P9tIRAp0RAJ9Ktz/x2Iq7NR74VavlOJdZ2cCDBgCeORXL kXWqzYA5Y2K/+YEMTC7Fm98= =BO1G -----END PGP SIGNATURE-----
May 03 2005
prev sibling next sibling parent reply B.G. <B.G._member pathlink.com> writes:
In article <d57bfd$1bpa$1 digitaldaemon.com>, Norbert Nemec says...
Anders F Bj=F6rklund schrieb:
 B.G. wrote:
=20
 I think =3D=3D=3D is just irritating, it should be entirely removed in=
favor of
 is/isnot.
=20 Why must the old ones be removed ? (you can use the new if you like)
In general: A good language does not only allow you to write your own=20 code comfortably, but also helps writing code that others can read. Having pointless freedom of choice clutters the language, puts=20 additional burden onto the implementors and the programmers as well.
That's the point, D does not deserve perlification ;-)
May 03 2005
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
B.G. wrote:

Why must the old ones be removed ? (you can use the new if you like)
Having pointless freedom of choice clutters the language, puts
additional burden onto the implementors and the programmers as well.
That's the point, D does not deserve perlification ;-)
Hey, I haven't even asked for the starship operator yet! :-) a <=> b would return the a.opCmp(b) value. (and similar for primitive values, of course) It comes in handy when writing custom opCmp methods... --anders
May 03 2005
parent B.G. <B.G._member pathlink.com> writes:
In article <d57j3f$1led$1 digitaldaemon.com>,
=?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= says...
B.G. wrote:

Why must the old ones be removed ? (you can use the new if you like)
Having pointless freedom of choice clutters the language, puts
additional burden onto the implementors and the programmers as well.
That's the point, D does not deserve perlification ;-)
Hey, I haven't even asked for the starship operator yet! :-) a <=> b would return the a.opCmp(b) value. (and similar for primitive values, of course) It comes in handy when writing custom opCmp methods... --anders
Well, as long as no alternatives like 'a cmp b' are allowed as well, I'm fine with that :) Though, there is probably some sane limit to this kind of improvements. Hey, just for the record... does anyone have more weird operator Ideas? Nothing comes to my own mind right now :)
May 03 2005
prev sibling parent reply David Medlock <amedlock nospam.org> writes:
Norbert Nemec wrote:
 Anders F Björklund schrieb:
 
 B.G. wrote:

 I think === is just irritating, it should be entirely removed in 
 favor of
 is/isnot.
Why must the old ones be removed ? (you can use the new if you like)
In general: A good language does not only allow you to write your own code comfortably, but also helps writing code that others can read. Having pointless freedom of choice clutters the language, puts additional burden onto the implementors and the programmers as well.
I agree with Norbert here. I like Python's philosophy of 'There Should be one _obvious_ way to do it'. The good news (if Walter drops ===) is that finding and replacing the occurrences will be a ton easier than if he dropped 'is' instead. -David
May 03 2005
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
David Medlock wrote:

 I agree with Norbert here.  I like Python's philosophy of 'There Should 
 be one _obvious_ way to do it'.
"Although that way may not be obvious at first unless you're Dutch." I don't, but that's another topic... (I like the Perl philosophy...) If you rip out the '===' and leave the '==' in D, that's OK with me. Taking out '!==' and just leaving 'is' would leave a big hole, though. --anders PS. The first one to suggest syntactical white space gets whacked. :-)
May 03 2005
parent reply "TechnoZeus" <TechnoZeus PeoplePC.com> writes:
"Anders F Björklund" <afb algonet.se> wrote in message
news:d57rls$236q$1 digitaldaemon.com...
 David Medlock wrote:

 I agree with Norbert here.  I like Python's philosophy of 'There Should
 be one _obvious_ way to do it'.
"Although that way may not be obvious at first unless you're Dutch." I don't, but that's another topic... (I like the Perl philosophy...) If you rip out the '===' and leave the '==' in D, that's OK with me. Taking out '!==' and just leaving 'is' would leave a big hole, though. --anders PS. The first one to suggest syntactical white space gets whacked. :-)
Somewhere in an earlier thread, "isnt" was suggested, to fill that gap. TZ
May 04 2005
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
TechnoZeus wrote:

Taking out '!==' and just leaving 'is' would leave a big hole, though.
Somewhere in an earlier thread, "isnt" was suggested, to fill that gap.
But that was months/years ago, and yet *nothing* has happened so far... http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/14705 I'll believe a new keyword when I see it. ("isnot" or "isnt" are fine) --anders
May 04 2005
prev sibling parent reply clayasaurus <clayasaurus gmail.com> writes:
I agree, we should either have (=== !==) or (is isnot), and (is isnot) 
is a lot easier to read and type.

There is no difference between === and is, is there?

The change is also trivial for anyone with some search/replace skills.

The only thing with the isnot operator is this stupid microsoft patent 
http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PG01&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.html&r=1&f=G&l=50&s1=%2220040230959%22.PGNR.&OS=DN/20040230959&RS=DN/20040230959

Well microsoft only did that for protection, right?

B.G. wrote:
 I think === is just irritating, it should be entirely removed in favor of
 is/isnot.
 
 After another beer it gets nearly impossible to differenciate from ==.
 Especially when it stands alone in the code. My programming experience has been
 lately enriched by another cool programming-'technique': to understand some
code
 I'm often fated to count ='s with the cursor and feel myself like an idiot :-)
 
 Just wondering, anyone else having optical troubles like that?
 
 
 
 
 
 
May 03 2005
next sibling parent "Ben Hinkle" <bhinkle mathworks.com> writes:
"clayasaurus" <clayasaurus gmail.com> wrote in message 
news:d581ms$2b6i$1 digitaldaemon.com...
I agree, we should either have (=== !==) or (is isnot), and (is isnot) is a 
lot easier to read and type.

 There is no difference between === and is, is there?

 The change is also trivial for anyone with some search/replace skills.

 The only thing with the isnot operator is this stupid microsoft patent 
 http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PG01&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.html&r=1&f=G&l=50&s1=%2220040230959%22.PGNR.&OS=DN/20040230959&RS=DN/20040230959

 Well microsoft only did that for protection, right?
yikes. scary stuff. Maybe Walter should add a statement in the spec saying "D would have an isnot-like operator if it weren't for <link>. Instead one can use !==." Maybe we should toss 'is' and patent === and !==. Innovate, baby!
May 03 2005
prev sibling next sibling parent reply Nick <Nick_member pathlink.com> writes:
In article <d581ms$2b6i$1 digitaldaemon.com>, clayasaurus says...
The only thing with the isnot operator is this stupid microsoft patent 
http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PG01&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.html&r=1&f=G&l=50&s1=%2220040230959%22.PGNR.&OS=DN/20040230959&RS=DN/20040230959

Well microsoft only did that for protection, right?
I think it only applies to BASIC-derived languages. To quote the patent text: "1. A system for determining if two operands point to different locations in memory, the system comprising: a compiler for receiving source code and generating executable code from the source code, the source code comprising an expression comprising an operator associated with a first operand and a second operand, the expression evaluating to true when the first operand and the second operand point to different memory locations. 2. The system of claim 1, wherein the compiler is a BASIC-derived programming language compiler." (But I'm not a lawyer.) Nick
May 03 2005
parent reply "Ben Hinkle" <bhinkle mathworks.com> writes:
"Nick" <Nick_member pathlink.com> wrote in message 
news:d588es$2ig7$1 digitaldaemon.com...
 In article <d581ms$2b6i$1 digitaldaemon.com>, clayasaurus says...
The only thing with the isnot operator is this stupid microsoft patent
http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PG01&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.html&r=1&f=G&l=50&s1=%2220040230959%22.PGNR.&OS=DN/20040230959&RS=DN/20040230959

Well microsoft only did that for protection, right?
I think it only applies to BASIC-derived languages. To quote the patent text: "1. A system for determining if two operands point to different locations in memory, the system comprising: a compiler for receiving source code and generating executable code from the source code, the source code comprising an expression comprising an operator associated with a first operand and a second operand, the expression evaluating to true when the first operand and the second operand point to different memory locations. 2. The system of claim 1, wherein the compiler is a BASIC-derived programming language compiler." (But I'm not a lawyer.)
I'm not a lawyer either but patents typically start with general claims and then narrow them down in case any of the general claims are challenged and found invalid. So claim 1 is a claim all by itself without reference to any particular language and claim 2 is giving a particular language in case the courts find claim 1 to be invalid. So in fact now that I think about it !== violates claim 1 since claim 1 doesn't say the operator needs to be some form of "isnot" - it just has to be "an operator". One would imagine C's operator != would serve as prior art for claim 1 but then we'd have to go to court to see. Has this patent been issued? I can't tell what the status of the thing is.
May 03 2005
parent "TechnoZeus" <TechnoZeus PeoplePC.com> writes:
"Ben Hinkle" <bhinkle mathworks.com> wrote in message
news:d58ci7$2mpf$1 digitaldaemon.com...
 "Nick" <Nick_member pathlink.com> wrote in message
 news:d588es$2ig7$1 digitaldaemon.com...
 In article <d581ms$2b6i$1 digitaldaemon.com>, clayasaurus says...
The only thing with the isnot operator is this stupid microsoft patent
http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PG01&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.html&r=1&f=G&l=50&s1=%2220040230959%22.PGNR.&OS=DN/20040230959&RS=DN/20040230959

Well microsoft only did that for protection, right?
I think it only applies to BASIC-derived languages. To quote the patent text: "1. A system for determining if two operands point to different locations in memory, the system comprising: a compiler for receiving source code and generating executable code from the source code, the source code comprising an expression comprising an operator associated with a first operand and a second operand, the expression evaluating to true when the first operand and the second operand point to different memory locations. 2. The system of claim 1, wherein the compiler is a BASIC-derived programming language compiler." (But I'm not a lawyer.)
I'm not a lawyer either but patents typically start with general claims and then narrow them down in case any of the general claims are challenged and found invalid. So claim 1 is a claim all by itself without reference to any particular language and claim 2 is giving a particular language in case the courts find claim 1 to be invalid. So in fact now that I think about it !== violates claim 1 since claim 1 doesn't say the operator needs to be some form of "isnot" - it just has to be "an operator". One would imagine C's operator != would serve as prior art for claim 1 but then we'd have to go to court to see. Has this patent been issued? I can't tell what the status of the thing is.
doesn't fully cover the generic form of the operation represented by the operator. In other words, since they are only talking about comparing "addresses" simply define that "is" and "isnt" compare "identities", where an identity consists of both the address and size of the item, rather than just the address. If either the address or the size is different, then the identities do not match. Of course, there are slice identities to consider, and cases where the identities match but the item types do not, and a bunch of other stuff, but I'm not suggesting the functionality be changed to fit an arbitrary definition... just that the definition should match the implementation, which already falls outside of any and all claims made in that patent. Also... one more reason to use "isnt" as the complement of the "is" operator. TZ
May 04 2005
prev sibling parent reply Derek Parnell <derek psych.ward> writes:
On Tue, 03 May 2005 10:26:46 -0400, clayasaurus wrote:

 I agree, we should either have (=== !==) or (is isnot), and (is isnot) 
 is a lot easier to read and type.
 The only thing with the isnot operator is this stupid microsoft patent 
 http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PG01&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.html&r=1&f=G&l=50&s1=%2220040230959%22.PGNR.&OS=DN/20040230959&RS=DN/20040230959
Aside from the morality of such a patent, the summary of it has at least two salient points ... " SUMMARY OF THE INVENTION [0015] A system, method and computer-readable medium support the use of a single operator that allows a comparison of two variables to determine if the two variables point to different locations in memory, that is, the reverse of the existing "Is" operator in a BASIC programming language or a derivative of BASIC or BASIC-like programming language. In one embodiment of the invention, the memory locations represent objects. The new operator enables a user to determine if the left operand (e.g., a reference type) "is not" the same instance as the reference type listed as the right operand. The use of a single operand for this concept may increase the readability of the programming language. " (a) It refers to BASIC type languages only (b) Acknowledges that the idea is a good one because it tries to enhance source code readability. plus it talks about "Is Not" and not "isnot" ;-) -- Derek Parnell Melbourne, Australia 4/05/2005 7:13:54 AM
May 03 2005
parent reply clayasaurus <clayasaurus gmail.com> writes:
Derek Parnell wrote:
 On Tue, 03 May 2005 10:26:46 -0400, clayasaurus wrote:
 
 
I agree, we should either have (=== !==) or (is isnot), and (is isnot) 
is a lot easier to read and type.
The only thing with the isnot operator is this stupid microsoft patent 
http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PG01&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.html&r=1&f=G&l=50&s1=%2220040230959%22.PGNR.&OS=DN/20040230959&RS=DN/20040230959
Aside from the morality of such a patent, the summary of it has at least two salient points ... " SUMMARY OF THE INVENTION [0015] A system, method and computer-readable medium support the use of a single operator that allows a comparison of two variables to determine if the two variables point to different locations in memory, that is, the reverse of the existing "Is" operator in a BASIC programming language or a derivative of BASIC or BASIC-like programming language. In one embodiment of the invention, the memory locations represent objects. The new operator enables a user to determine if the left operand (e.g., a reference type) "is not" the same instance as the reference type listed as the right operand. The use of a single operand for this concept may increase the readability of the programming language. " (a) It refers to BASIC type languages only (b) Acknowledges that the idea is a good one because it tries to enhance source code readability. plus it talks about "Is Not" and not "isnot" ;-)
"[0028] In accordance with one embodiment of the invention, the above statement "If Not (x Is Nothing)" which combines the use of two operators, "Is" and "Not", may be replaced with a single operator. The keyword for the single operator may be "IsNot", "is_not" or any other suitable keyword which reasonably conveys the concept of "is not". " Anyway, as Ben has said, C language has prior art with a != b, when both a and b are pointers. I don't think this patent should scare off the D community from using isnot.
May 03 2005
parent Derek Parnell <derek psych.ward> writes:
On Tue, 03 May 2005 17:34:49 +0000, clayasaurus wrote:

 Derek Parnell wrote:
 On Tue, 03 May 2005 10:26:46 -0400, clayasaurus wrote:
 
 
I agree, we should either have (=== !==) or (is isnot), and (is isnot) 
is a lot easier to read and type.
The only thing with the isnot operator is this stupid microsoft patent 
http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PG01&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.html&r=1&f=G&l=50&s1=%2220040230959%22.PGNR.&OS=DN/20040230959&RS=DN/20040230959
Aside from the morality of such a patent, the summary of it has at least two salient points ... " SUMMARY OF THE INVENTION [0015] A system, method and computer-readable medium support the use of a single operator that allows a comparison of two variables to determine if the two variables point to different locations in memory, that is, the reverse of the existing "Is" operator in a BASIC programming language or a derivative of BASIC or BASIC-like programming language. In one embodiment of the invention, the memory locations represent objects. The new operator enables a user to determine if the left operand (e.g., a reference type) "is not" the same instance as the reference type listed as the right operand. The use of a single operand for this concept may increase the readability of the programming language. " (a) It refers to BASIC type languages only (b) Acknowledges that the idea is a good one because it tries to enhance source code readability. plus it talks about "Is Not" and not "isnot" ;-)
"[0028] In accordance with one embodiment of the invention, the above statement "If Not (x Is Nothing)" which combines the use of two operators, "Is" and "Not", may be replaced with a single operator. The keyword for the single operator may be "IsNot", "is_not" or any other suitable keyword which reasonably conveys the concept of "is not". "
Ok, I admit my eyes started to go blurring before this point ;-) I wonder if the patent can also be applied to English text ;-)
 Anyway, as Ben has said, C language has prior art with a != b, when both 
 a and b are pointers. I don't think this patent should scare off the D 
 community from using isnot.
Oh I agree that nobody should be scared off by this evil attempt at killing off common sense. However the C prior art is not actually the same thing. The C != is just comparing the values of two variables which is not the same as comparing the locations of two object instances. The != operator, by itself, does not cause object references to be compared. -- Derek Parnell Melbourne, Australia http://www.dsource.org/projects/build v2.05 is now available. 02/May/2005 4/05/2005 7:37:59 AM
May 03 2005