On Mon, Feb 11, 2013 at 09:56:31AM +0000, Nicholas Clark wrote:
> Here are a better set of patches for Rakudo. They don't duplicate the check
> for $p < 0, and they avoid calling nqp::elems(), by assuming that nqp::atpos()
> safely return nql::null() for indices beyond the end of the array.
> (Which Parrot does. Is any of this spec'd anywhere?)

AFAIK, Parrot has never spec'd that elements beyond the end of array
return PMCNULL, which is one reason I've avoided relying on it.
Also, I'm concerned that other VM platforms might not have the same 
characteristic as Parrot, while I am sure that nqp::elems() will
be available and will be inexpensive.

> This still holds. Style-wise, it would be possible to avoid using return-rw
> by using a nested ?? !! - which is considered better?

Since return-rw involves extra function calls (to return-rw, for one,
plus the internal code blocks it uses) and various exception handlers 
to capture and handle the return, it's definitely worth avoiding 
when not needed.

Pm

Reply via email to