The Is Operator
Bill Baxter
dnewsgroup at billbaxter.com
Tue Oct 2 14:29:37 PDT 2007
Kyle G. wrote:
> Hi,
>
> First time posting here on the NG, and certainly not my last.
>
> D has a good deal of syntactic sugar which results in easier to read
> code. However, there's one particular thing that has been bothering me
> for a while now:
>
> void foo(void[] var) {
> if (var !is null)
> // line of code
> }
>
> int main() {
> foo(null);
> }
>
> The code I am concerned about is "var !is null" which appears to
> translate to "var not is null" when it actually means "var is not null."
> Is there any special reason why we are unable to do "var isnot null" or
> "var is not null"?
Only reason is that it would require adding an extra keyword to the
language.
More annoying to me is that !in doesn't work.
--bb
More information about the Digitalmars-d
mailing list