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

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

Thread Previous | Thread Next
Paul "LeoNerd" Evans
December 18, 2021 23:19
Re: Pre-RFC: `unknown` versus `undef`
Message ID:
On Sat, 18 Dec 2021 15:02:05 -0800
Darren Duncan <> 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      |  |

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