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

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

Thread Previous | Thread Next
From:
Martijn Lievaart
Date:
December 19, 2021 10:46
Subject:
Re: Pre-RFC: `unknown` versus `undef`
Message ID:
348cd4a5-87e1-f79f-cfe0-79e62731bcb3@rtij.nl
Op 19-12-2021 om 11:41 schreef Darren Duncan:
> On 2021-12-19 2:01 a.m., Martijn Lievaart wrote:
>>
>> So what does Excuse("unknown value") plus Excude("unauthorized) 
>> return? You just reintroduced the same problem that made you decide 
>> against NVL, unless I'm missing something.
>
> The answer is that attempting to do that fails because addition is not 
> defined for Excuse values.  For example, it could result in something 
> like:
>
>   Excuse("No_Matching_Routine_Found", "plus", [@_])
>
> That Excuse value can either be returned, or if desired, thrown as an 
> exception.
>
> A key part of what makes this NOT N-valued-logic is that the result of 
> trying to use some arbitrary non-existent routine with an Excuse value 
> always returns the same base result, an Excuse of subtype 
> "No_Matching_Routine_Found", with added info naming the name and 
> arguments attempted, and that there is NOT logic to test every 
> possible Excuse subtype to determine what kind of result to give.
>
> Basically an Excuse is an unthrown exception, and is treated similarly.
>
> In this context, the version where there is exactly the 1 singleton 
> Unknown etc is analagous to die() always throwing the same generic 
> exception "I died" without any further information.
>

Ahh, makes sense. I'm still not completely convinced it's a good idea 
(nor saying it isn't!), but I agree you solved the original problem.


HTH,

M4



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