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

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

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
December 18, 2021 23:19
Subject:
Re: Pre-RFC: `unknown` versus `undef`
Message ID:
20211218231850.1f5df447@shy.leonerd.org.uk
On Sat, 18 Dec 2021 15:02:05 -0800
Darren Duncan <darren@darrenduncan.net> wrote:

> > But then that means that to be consistent with that, here:
> > 
> >     if ($foo) {
> >         bar();
> >     } else {
> >         baz();
> >     }
> > 
> > if $foo is unknown we can't enter either block  
> 
> Yes, and that's the answer.  I would argue that when given an unknown
> input the effect of this block would be a no-op.

I think if you were to present this if/else code to anyone not
intimately familiar with this three-value logic idea, and tell them
there is a value you can put in $foo which makes neither branch
execute, they would look at you strangely and consider you quite mad.

There may be a Lewis Carroll quote applicable here...

Suffice to say, at this point I really don't feel like it's something
we want to be entertaining in a regular language with regular keywords.
If such a 3VL system were added, it really wants to have its own
keywords and syntax, so people are appropriately warned that Weird
Things are afoot.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

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