Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: "undef" is not NULL and what to do about it

by sundialsvc4 (Abbot)
on Feb 20, 2013 at 17:43 UTC ( #1019813=note: print w/ replies, xml ) Need Help??


in reply to "undef" is not NULL and what to do about it

I certainly would like to see good, clean semantics (in the context of Perl-5, which is actually here, as opposed to the maybe-someday Perl-6) that expresses at least the following two ideas:

  • NULL:   “it is known that there is the absence of a value.”
  • unknown:   “it is known that the value is unknown.”

undef, as “the value of this variable has not yet been defined,” indeed has been over-applied ... it has been stretched into service to cover all of these cases because the Perl language (AFAIK) offers nothing else.

What I do not know, of course, is what to do about it.   I do not delve into the world of perlguts.   But I endorse what you are saying here and would certainly like to find an improvement, operating within the context of Perl five.   (And, y’know, “if we can do Moose, we ought to be able to do this.”)

The fly in the ointment, of course, will be compatibility.   Any new ideas, no matter how great they may be, must somehow be introduced into the present.   That means, in particular, DBI, which currently uses undef to represent NULL ... this, indeed, being the best design-choice that has been available so-far.   As code begins to appear on the scene which supports these new semantics that both you and I apparently dream-of, it must be compatible somehow.   It must, “Just Work.™”


Comment on Re: "undef" is not NULL and what to do about it
Re^2: "undef" is not NULL and what to do about it
by herveus (Parson) on Feb 25, 2013 at 20:28 UTC
    Howdy!

    NULL as used in relational databases still carries semantic ambiguity.

    It could indicate that the value is absent, or it could indicate that the value is unknown. Or it could mean either. If I recall correctly, Codd called for multiple flavors of NULL.

    yours,
    Michael

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1019813]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2014-10-02 08:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (51 votes), past polls