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.™”
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||