On Mon, Jul 22, 2013 at 4:44 PM, David E. Wheeler <david@justatheory.com>wrote: > > Crazy? Impossible? Terrifying? > Have you looked at the way Golang does exceptions? Their documentation discourages exception-driven control flow -- everything returns lists, and the convention is to make the second element the completion status, to avoid the out-of-band problem of returning special failure values -- but one could do it with their available tools. The most important of these tools is a deferred block, which executes at scope-tear-down time, like CPAN's OnScopeExit or LocalOnExit. They also have a global exception objectl like Perl's $@, which is loaded with "panic" and can be consumed with "recover." If Perl were to (1) support a DEFER block that worked that way and (2) stop clobbering defined $@ (has that been fixed? I remember discussion about automatically localizing $@ in DESTROY) until it is consumed by an equivalent to golang's "recover" that would be, in my opinion, more powerful than adopting the try/catch idiom into the core language. Maybe golang-style panics would be best given their own parallel system, rather than touching the semantics of $@, no matter how slightly. In short, I'm opposed to try/catch, as I think it's a tired idiom with superior alternatives, including what Perl's already got. -- You've got to wiggle before you can crawlThread Previous | Thread Next