develooper Front page | perl.perl5.porters | Postings from December 2021

Re: Pre-RFC: `unknown` versus `undef`

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
December 19, 2021 15:12
Subject:
Re: Pre-RFC: `unknown` versus `undef`
Message ID:
20211219161146.5e48ea18@pc09
On Sun, 19 Dec 2021 12:45:18 +0000 (UTC), Ovid via perl5-porters <perl5-porters@perl.org> wrote:

> On Sunday, 19 December 2021, 13:28:23 CET, Oodler 577 <oodler577@sdf-eu.org> wrote:
> 
> 
> > Thank you, this is super helpful. My final comment is just to
> > reiterate what I most recently said; as long as this doesn't
> > affect how things currently work with undef/q{}/0 and existing
> > built-ins/ops; and we get a C<unknown> built-in that does for
> > unknown values what C<defined> does for undef'd values,   
> 
> For interpolation, I would suggest it behave like undef, but with a
> warning. I would (only half-joking here), also consider it to
> stringify to U+FFFD REPLACEMENT CHARACTER.

100% joking: 016844 𖡄 BAMUM LETTER PHASE-A UNKNOWN

>     my $name = unknown;
>     say "Hello, $name!";
> 
> Output:
> 
>     Use of unknown value $name in say at ...
>     Hello, �!
> 
> > As an exercise, I wonder how many use cases for undef would remain
> > if unknown was available. If the answer is "not many", then maybe
> > the answer would be a compatible tweak to undef and not the
> > creation of a new special value. Just a thought...  
> 
> I would not recommend changing current behavior of undef. That would
> be widespread carnage.
>
> Ovid

-- 
H.Merijn Brand  https://tux.nl   Perl Monger   http://amsterdam.pm.org/
using perl5.00307 .. 5.33        porting perl5 on HP-UX, AIX, and Linux
https://tux.nl/email.html http://qa.perl.org https://www.test-smoke.org
                           

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