Re: !in operator?

2009-05-25 Thread Leandro Lucarella
Frits van Bommel, el 25 de mayo a las 12:37 me escribiste: > Stewart Gordon wrote: > >Jason House wrote: > > > >>Method 1: > >> > >>if (x !in y) > >> foo(); > >>else{ > >> auto z = x in y; > >> bar(z); > >>} > >> > >>Method 2: > >> > >>auto z = x in y; > >>if (z is null) > >> foo; > >>else > >>

Re: !in operator?

2009-05-25 Thread Frits van Bommel
Stewart Gordon wrote: Jason House wrote: Method 1: if (x !in y) foo(); else{ auto z = x in y; bar(z); } Method 2: auto z = x in y; if (z is null) foo; else bar(z); Method 1 essentially calls in twice while method 2 calls in once. But there's no requirement to look it up after f

Re: !in operator?

2009-05-24 Thread Stewart Gordon
Jason House wrote: Method 1: if (x !in y) foo(); else{ auto z = x in y; bar(z); } Method 2: auto z = x in y; if (z is null) foo; else bar(z); Method 1 essentially calls in twice while method 2 calls in once. But there's no requirement to look it up after finding out whether it's

Re: !in operator?

2009-05-24 Thread bearophile
Jason House: > Method 1 essentially calls in twice while method 2 calls in once. Sometimes I just want to know if something isn't present. Having !in doesn't prevent me from writing and using x = y in aa; when I want it. > PS: Please don't assume that I'm advocating

Re: !in operator?

2009-05-24 Thread Jason House
Stewart Gordon Wrote: > Jason House wrote: > > > That is unfortunately a rather sticky point. The in operator does not > > return bool. I think the lack of !in is to encourage writing of efficient > > code. I'm not really sure though. > > How, exa

Re: !in operator?

2009-05-24 Thread Stewart Gordon
Jason House wrote: That is unfortunately a rather sticky point. The in operator does not return bool. I think the lack of !in is to encourage writing of efficient code. I'm not really sure though. How, exactly, does not having !in make code efficient? Stewart.

Re: !in operator?

2009-05-24 Thread Stewart Gordon
Jeremie Pelletier wrote: Why is there no !in operator just like there is a !is operator? Is it because this expression evaluates to a pointer to the found element? Of course not. This compiles: void main() { char* abc; assert (!abc); } so why shouldn't !in? Stewart.

Re: !in operator?

2009-05-23 Thread downs
Jeremie Pelletier wrote: > Why is there no !in operator just like there is a !is operator? > Is it because this expression evaluates to a pointer to the found element? > Even so, it would make asserts much easier to write. http://dsource.org/projects/scrapple/browser/trunk/tools/too

Re: !in operator?

2009-05-22 Thread bearophile
Jason House: > The in operator does not > return bool. I think the lack of !in is to encourage writing of efficient > code. I'm not really sure though. Lot of time ago I have said I'd like !in, I'm waiting for it still. Bye, bearophile

Re: !in operator?

2009-05-22 Thread Jason House
Jeremie Pelletier wrote: > Why is there no !in operator just like there is a !is operator? > Is it because this expression evaluates to a pointer to the found element? > Even so, it would make asserts much easier to write. That is unfortunately a rather sticky point. The in operator

!in operator?

2009-05-22 Thread Jeremie Pelletier
Why is there no !in operator just like there is a !is operator? Is it because this expression evaluates to a pointer to the found element? Even so, it would make asserts much easier to write.