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.