On 2014-02-08 13:45, John Peacock wrote:
On 02/08/2014 02:37 AM, demerphq wrote:

Interesting idea. How would a user throw an error that would use this?
Or do you see it restricted to core errors only?
error::throw($code,$reason) would seem to be the obvious answer there.
The only thing that makes me uncomfortable about that is that it
magically affects the special $@ variable.

On the other hand, we could make that more explicit by using
$@->throw($code, $reason). Then the other suggested calls become
$@->code and $@->is_error. If we are actually going to make $@ an
object, we should embrace object methods, instead of some functional
call. If the object design is thought through, you could even call
->throw on it at multiple levels and store the stack trace, with
multiple code/reasons, for eventual introspection.
I think this is easier to implement after adding some pseudo-signals,
like __CATCH__ and __THROW__.


Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 14 of 16 | next ›
Discussion Overview
groupperl5-porters @
postedFeb 6, '14 at 10:26p
activeFeb 25, '14 at 5:03p



site design / logo © 2021 Grokbase