develooper Front page | perl.perl5.porters | Postings from October 2011

Re: Are exceptions "still broken" in core Perl?

Thread Previous | Thread Next
From:
Joshua ben Jore
Date:
October 26, 2011 05:50
Subject:
Re: Are exceptions "still broken" in core Perl?
Message ID:
CAHmiend9OkcTqY_Nf9=8_G+bSJD4-kdNjq4L2Mdrrzg572Ld9A@mail.gmail.com
We might be in global destruction and that object might have been
destroyed prior to being used. Something might have broken bigint::
from the outside. It might be a poorly behaved constant if the author
of the constant overloading class made some kind of mistake.

About the only thing that's reliable are XS macros. Maybe just SvOK.
You can't test $@ for that thought since it always has something in
it. SvTRUE || SvROK might work on $@ generally.

Josh

On Wed, Oct 26, 2011 at 2:34 AM, Chas. Owens <chas.owens@gmail.com> wrote:
>
> On Oct 25, 2011 11:21 PM, "Joshua ben Jore" <twists@gmail.com> wrote:
>>
>> That only works as long as your '1' hasn't been rewritten as an
>> overloaded literal.
>>
>>    use bigint;
>>    eval {
>>        ...
>>        1; # secretly, an object which will have ->
>>    } or ...;
>>
>> There's really nothing you can count on.
>
> Yes, but 1 would still be true in that case.  If the literal 1 cannot be
> counted on to be true, then lots if other assumptions are going to break as
> well.  People who muck about with constants are responsible for ensuring
> their code still works.
>

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