develooper Front page | perl.perl5.porters | Postings from June 2022

Re: Core exception types [was: Re: Pre-RFC: Improve “wide character” warnings]

Thread Previous | Thread Next
From:
Ovid
Date:
June 8, 2022 14:13
Subject:
Re: Core exception types [was: Re: Pre-RFC: Improve “wide character” warnings]
Message ID:
CA+M4CHuuNsmXTJa+O=7cm7R7sjWqb7QtR+UbV2i1etPqVx7ouQ@mail.gmail.com
On Wed, Jun 8, 2022 at 2:39 PM Felipe Gasper <felipe@felipegasper.com>
wrote:

> Attaching metadata to plain scalars could be powerful. It feels like it
> would encourage “weirdness”, but I haven’t researched it. I know
> decorator-type things are a common feature in other languages.
>

Side note: there are many awesome things we could do with metadata, if we
could find a decent API. The difference between "uninitialized" and
"undefined" would be amazing. Pseudo-code because I have no idea what an
API would look like:

    sub name ($self, ?$name) {
        if (  not builtin:uninitialized($name) ) {
             # or: builtin:initialized($name) would return true even if
undef
            $self->{name} = $name;
        }
        return $name;
    }

That would make it *much easier* to eliminate @_.

Best,
Ovid
CTO, All Around the World
World-class software development and consulting
https://allaroundtheworld.fr/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About