in reply to Re^2: Is // a "Null coalescing operator" ?
in thread Is // a "Null coalescing operator" ?

I already read the definition but I wasn't sure what a "nullable type"¹) was supposed to mean.

So you ask "what does nullable type mean?" see? :)

So you say "null" in C# corresponds to "undef" in Perl?

Yes, in the case of defined-or operator, in perl it really means not-undef-or and in C# it means not-null-or

See the caveats Nullable Types (C#)

Then consequently these attempts to list the or-operators from JS, Ruby and Python as examples are wrong(?)

I don't see how

  • Comment on Re^3: Is // a "Null coalescing operator" ?

Replies are listed 'Best First'.
Re^4: Is // a "Null coalescing operator" ?
by LanX (Saint) on Aug 09, 2010 at 10:33 UTC
      I don't know C#, but what you quote refers to a database NULL. The term "coalesc" is something I associate with databases as well.

      A (relational) database NULL is certainly not equivalent to a Perl undef. Ignoring lots of details, the basic difference is:

      undef binary-OP defined-value -> defined-value NULL binary-OP not-NULL -> NULL
      In other words, once you have a NULL, if you apply operations to it (except a few special ones), you remain having a NULL. undef is quite different - it happily behaves like a defined value (0, or the empty string), and once you start applying (most) operations on it, it becomes defined.
      NULL + 1 == NULL undef + 1 == 1