in reply to Re: 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 say "null" in C# corresponds to "undef" in Perl?

(e.g. JS has both, "undefined" and "null", which are different)

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

Cheers Rolf

1) I imagine a non-nullable type is a type which doesn't allow uninitializing declarations, or in perl-lingo  my $typevar wouldn't be allowed but  my $typevar=init() would.

Replies are listed 'Best First'.
Re^3: Is // a "Null coalescing operator" ?
by Anonymous Monk on Aug 09, 2010 at 01:54 UTC
    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

        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