develooper Front page | perl.perl5.porters | Postings from July 2013

Re: Re: Try/Catch Exception Objects: Possible?

Thread Previous | Thread Next
July 23, 2013 22:50
Re: Re: Try/Catch Exception Objects: Possible?
Message ID:
On Tuesday, July 23, 2013 12:29:19 PM Ricardo Signes wrote:

> We should apply a patch that does nothing but make internal errors become
> objects with overloaded stringification.  Then we can see how much of the
> core tests, and of the CPAN, breaks.  We may be surprised by the results.

I worked on this for several days at the end of last year. My approach was 
simple: make Perl_croak_sv() turn exception strings into full-blown exception 
objects with the string as the payload. After some work faking up a new 
package ('CORE::Exception'), I flailed around with overload magic for a while, 
and never quite managed to get everything all working together to the point 
where enough of the test suite passed successfully that I could diagnose what 
went wrong.

In retrospect, the worst part was probably trying to manage a new Perl class 
(well, namespace and methods and overloading) from XS. Loading it from a .pm 
file wasn't any better, as you can imagine that introduced introducing 
bootstrapping issues.

I can't find the relevant branch at the moment, but I'm not sure there is much 
left salvaging at this point.

-- c

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