Re: If !in is inconsistent because of bool/pointer, then so is !

2009-02-08 Thread Simen Kjaeraas
On Sat, 07 Feb 2009 00:39:33 +0100, Rainer Deyke rain...@eldwood.com wrote: (Of course '!=' (as the opposite of '==' as opposed to '=') is already a special case, so perhaps defining the '!op' operators individually is unavoidable. 'a !== b' as '!(a == b)' would work, but 'a != b' as '!(a =

Re: If !in is inconsistent because of bool/pointer, then so is !

2009-02-07 Thread Don
Rainer Deyke wrote: Daniel Keep wrote: Rainer Deyke wrote: This is, in my opinion, a significant design error in the language. The difference between '!(a b)' and 'a ! b' is not obvious. There is nothing about the operator '' that suggests that it should set a global exception state, and

Re: If !in is inconsistent because of bool/pointer, then so is !

2009-02-07 Thread downs
Bill Baxter wrote: On Sat, Feb 7, 2009 at 8:54 AM, bearophile bearophileh...@lycos.com wrote: Rainer Deyke: It's a question of consistent patterns versus special cases. You may think that for humans it's better to have a very orthogonal language, like for example Scheme. There's also a

Re: If !in is inconsistent because of bool/pointer, then so is !

2009-02-06 Thread Moritz Warning
On Fri, 06 Feb 2009 12:42:30 +0100, downs wrote: This has been brought up before as an argument against the !in operator (forcing us to resort to such workarounds as /notin/): that the !in operator would have inconsistent syntax with in, because in returns a pointer and !in would return a

Re: If !in is inconsistent because of bool/pointer, then so is !

2009-02-06 Thread Rainer Deyke
downs wrote: This is NOT a reason against !in. In fact, this so-called inconsistency is already present in the language. If we remember, !pointer already transforms it into a boolean, so it would actually be more consistent if !in changed the return type to bool. I agree. 'a != b' is short

Re: If !in is inconsistent because of bool/pointer, then so is !

2009-02-06 Thread downs
Rainer Deyke wrote: downs wrote: This is NOT a reason against !in. In fact, this so-called inconsistency is already present in the language. If we remember, !pointer already transforms it into a boolean, so it would actually be more consistent if !in changed the return type to bool. I

Re: If !in is inconsistent because of bool/pointer, then so is !

2009-02-06 Thread Rainer Deyke
downs wrote: A large part of the case for !in is that you can pronounce it a *not in* b. !+, on the other hand, would be .. what? a not plus b? does that mean a - b? :) It's a question of consistent patterns versus special cases. If 'a !op b == !(a op b)', then the parser can rewrite all 'a

Re: If !in is inconsistent because of bool/pointer, then so is !

2009-02-06 Thread bearophile
Rainer Deyke: It's a question of consistent patterns versus special cases. You may think that for humans it's better to have a very orthogonal language, like for example Scheme. There's also a famous quote about this, Programming languages should be designed not by piling feature on top of

Re: If !in is inconsistent because of bool/pointer, then so is !

2009-02-06 Thread Bill Baxter
On Sat, Feb 7, 2009 at 8:54 AM, bearophile bearophileh...@lycos.com wrote: Rainer Deyke: It's a question of consistent patterns versus special cases. You may think that for humans it's better to have a very orthogonal language, like for example Scheme. There's also a famous quote about

Re: If !in is inconsistent because of bool/pointer, then so is !

2009-02-06 Thread bearophile
Bill Baxter: (a !in b) should exist and it should be the same as !(a in b). Of course. Bye, bearophile

Re: If !in is inconsistent because of bool/pointer, then so is !

2009-02-06 Thread Rainer Deyke
Bill Baxter wrote: Note that D already has things like !. But quoth the spec: For floating point comparison operators, (a !op b) is *NOT* the same as !(a op b). [emphasis added] I had to check the spec for the difference. 'a ! b' and '!(a b)' /are/ equivalent in the sense that '(a ! b)

Re: If !in is inconsistent because of bool/pointer, then so is !

2009-02-06 Thread Daniel Keep
Rainer Deyke wrote: Bill Baxter wrote: Note that D already has things like !. But quoth the spec: For floating point comparison operators, (a !op b) is *NOT* the same as !(a op b). [emphasis added] I had to check the spec for the difference. 'a ! b' and '!(a b)' /are/ equivalent in

Re: If !in is inconsistent because of bool/pointer, then so is !

2009-02-06 Thread Don
Daniel Keep wrote: Rainer Deyke wrote: Bill Baxter wrote: Note that D already has things like !. But quoth the spec: For floating point comparison operators, (a !op b) is *NOT* the same as !(a op b). [emphasis added] I had to check the spec for the difference. 'a ! b' and '!(a b)' /are/

Re: If !in is inconsistent because of bool/pointer, then so is !

2009-02-06 Thread Rainer Deyke
Daniel Keep wrote: Rainer Deyke wrote: This is, in my opinion, a significant design error in the language. The difference between '!(a b)' and 'a ! b' is not obvious. There is nothing about the operator '' that suggests that it should set a global exception state, and there is nothing