Allison Randal wrote:
The Exception PMC never had a get_bool vtable function implemented, but it did previously inherit one from ResizablePMCArray. So, that test was relying on an implementation artifact.

OK, then that was certainly a wart, agreed.

Under what circumstances should an exception report TRUE? Under the old implementation, since it was using ResizablePMCArray, it would report TRUE if any data was stored in the exception. That is, it always reported TRUE, because 'init' prefilled the first 11 slots in the exception's array.
In Perl 6, truth is supposed to fall back to whether something is defined or not. So a try with an error occurring sets $!, making it defined, so "if $! { ... }" runs the block if there's an error. And if there's no error, $! is not defined.

Parrot shouldn't necessarily just do whatever Perl 6 needs, though, and in the end we maybe should in Rakudo have "if $! { ... }" really calling $!.true or 'prefix:?'($!) - and off the top of my head, I'm not sure which is right. At the moment we just generate:

   find_lex $P17, "$!"
   if $P17, if_16

So I think this likely needs a bit more thought from the Rakudo side before we rush and stick a get_bool into the Exception PMC. Maybe something to work out next week at YAPC...

Thanks for the clarification from the Parrot side of things!

Jonathan

Reply via email to