Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Existing module for PerlX::Maybe except for hash existence?

by cavac (Prior)
on Feb 24, 2025 at 16:18 UTC ( [id://11164072]=note: print w/replies, xml ) Need Help??


in reply to Re: Existing module for PerlX::Maybe except for hash existence?
in thread Existing module for PerlX::Maybe except for hash existence?

Both are saying "The caller does not provide a defined value", but there is no hint why you need two different ways to say that

My guess is that it's the difference "the caller does not have/want a value for this" and "the caller forgot to specify the value"

Take one example: A program called SchrödingersCat needs a command line flag to specify if the cat is alive or dead. But when called with a value of "undef", the caller provides a valid value of "we don't know if the cat is alive or dead". See Tom Scott's video on Null Island: The Busiest Place That Doesn't Exist

PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
Also check out my sisters artwork and my weekly webcomics
  • Comment on Re^2: Existing module for PerlX::Maybe except for hash existence?

Replies are listed 'Best First'.
Re^3: Existing module for PerlX::Maybe except for hash existence?
by haj (Vicar) on Feb 24, 2025 at 17:53 UTC
    Take one example: A program called SchrödingersCat needs a command line flag to specify if the cat is alive or dead. But when called with a value of "undef", ...

    A nice example, indeed. Just one question: How do you pass an undefined value as a command line flag?

    See Tom Scott's video....

    Thanks: Another example which underpins my point. The video explains the difference between NULL, "NULL" and 0 when read from a database. So yes, a database has NULL as the equivalent of an undefined value. But a database has no notion of "this field does not exist": If a field is in a table definition, then it exists for every single record. So, again, it has only one special value, not two.

Re^3: Existing module for PerlX::Maybe except for hash existence?
by ikegami (Patriarch) on Feb 24, 2025 at 18:44 UTC

    Your example fails.

    There are three states: Alive, dead, superposition.

    There's no need to differentiate between not provided and undef. Both would be considered superposition.

    And you mention command-line arguments where it's not even possible to pass undef, completely defying your point.

    Your example supports haj, not you.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2025-06-19 13:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.