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

Re: Try/Catch Exception Objects: Possible?

Thread Previous | Thread Next
From:
David E. Wheeler
Date:
July 26, 2013 12:12
Subject:
Re: Try/Catch Exception Objects: Possible?
Message ID:
F0136A9A-A97A-44B5-8729-A9072B6CACB5@justatheory.com
On Jul 26, 2013, at 1:00 PM, Leon Timmermans <fawaka@gmail.com> wrote:

>> Now, if there could be some lazy way to reference a point in Perl
>> time/code/memory at the time an exception was thrown, that made it
>> possible to introspect the stack that occurred at that time, in an
>> efficient manner, that'd be cool.

Yeah, this is something I was wondering about, as well.

> That sounds a bit like Yuval's Devel::StackTrace::XS [1]

Hard to tell; no docs!

>> I'd be especially cool, because it wouldn't inherently bind you to
>> having one type of stack trace presentation, and one type of stack
>> trace presentation only, things like Carp::Always could hook in to
>> this facility, ie:
>> 
>> if ( $_->isa('exceptionything') ) {
>>   my $stack = CORE::stacktracefor($_);
>>   print $_->message . custom_stacktrace_formatter($stack);
>> }
>> 
>> ( The point being its useful to be able to decouple the presentation
>> logic from the actual exception implementation so that presentation
>> can be changed at the top level when needed )
> 
> Agreed

Yes, if this is possible, it would be preferred: Defer iterating over the stack trace until someone asks for it.

Best,

David


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