develooper Front page | perl.perl6.users | Postings from March 2023

Re: Undefine mixed data

Thread Previous | Thread Next
Ralph Mellor
March 21, 2023 21:45
Re: Undefine mixed data
Message ID:
I see weaknesses in my attempt to explain Raku's design related to

(I personally think there would best be a documentation page dedicated to the
triumvirate of definiteness, definedness, and truthiness, but here I'm trying to
achieve a balance between being short enough for this context -- an email in a
thread about the deprecation of `undefine` -- and long enough to outline the key
aspects of this carefully designed part of Raku, enough so folk might stop just
assuming it is broken in ways that it's not. The issue really is just
and where we go next now it is deprecated, not assuming there's some big
broad problem due to ignorance of Raku's design.)

On Mon, Mar 20, 2023 at 10:42 PM Ralph Mellor <> wrote:
> Let me first summarize relevant parts of Raku's design. These are not
> going to change. They've been in place for 2 decades and work great.

That bit I'm confident about.

I'm also happy with the "definiteness" paragraph and OK with the "truthiness"
paragraph. (Also, the latter is a well known concept in PLs so I don't feel I
need to unduly worry about nailing the latter. Hopefully it just makes sense
to readers even without me being especially careful.)

It's my "definedness" description that seems to me potentially problematic.
I feel like I didn't do a good enough job. Here's my attempt to
sufficiently fix it:

> If a value is indefinite (eg the type object `Tree`) then it is not defined.

If an object is indefinite (eg the type object `Tree`) then, if it is treated as
a potentially defined value (eg `.defined` is called on it as a test, or one of
the constructs that test the `.defined` value is used, such as `with`), then it
is considered not defined.

> A `Failure` instance is definite (because it's an instance, per the previous
> paragraph), yet it is undefined (because it's an instance of a failure).

A `Failure` instance is definite (because it's an instance, per the previous
paragraph), yet is not defined (so that code that tests its definedness, by
calling `.defined`, will know that something is amiss. (At the opposite
extreme, if code carelessly treats a value as if it is fine, without making
any attempt to check, and it's a failure instance, it will "blow up", throwing
an exception.)


If anyone reads this I'd appreciate hearing whether they are happy that I
wrote this email, even if they disagree with my appreciation of the merits
of Raku's design.

love, ralph

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About