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

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

Thread Previous | Thread Next
From:
Alexander Hartmaier
Date:
June 9, 2022 06:44
Subject:
Re: $@ alternative WAS Re: Core exception types [was: Re: Pre-RFC: Improve “wide character” warnings]
Message ID:
CAB49QrZpJt8y2BDLvN4dxgL7ivLRJSqOmr-ns7-WERn9x0R3tg@mail.gmail.com
On Thu, Jun 9, 2022 at 4:18 AM Karen Etheridge <perl@froods.org> wrote:

> On Wed, Jun 8, 2022 at 12:56 PM Dan Book <grinnz@gmail.com> wrote:
>
>> Whenever $@ is populated, the relevant logic would check to see if the
>>> active feature set dictates putting the object or the string into $@.
>>>
>>
>> This is exactly the problem. The lexical feature would have an effect on
>> the exact problematic code we are discussing (which is by the way not
>> "esoteric" in any useful sense of the word, we simply cannot break it),
>> which is not in the scope of the feature.
>>
>
> If I'm following correctly, we want the *caller* of the exception-throwing
> code to decide whether it wants an error string or an error object.
> Therefore, make $@ into a dualvar-like construct that holds both pieces of
> information, and use the context of the caller to decide which form is used
> in an expression containing $@.
>

That's also what I'd propose if implementing it is possible.

That would also scratch my itch of having to decide, if to include a
stacktrace or not when *throwing* an exception instead of being able to
extract it from the exception on the catching side.
Return exception text to user, log stracktrace for example.

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