develooper Front page | perl.perl5.porters | Postings from November 2005

Re: [PATCH] sort/multicall patch

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
November 6, 2005 06:07
Subject:
Re: [PATCH] sort/multicall patch
Message ID:
20051106140802.GL3585@iabyn.com
On Sat, Nov 05, 2005 at 11:58:16AM +0000, Robin Houston wrote:
> On Sat, Nov 05, 2005 at 02:52:08AM +0000, Dave Mitchell wrote:
> > * should PUSH_MULTICALL take the CV as an arg rather than implicitly using
> > the cv variable?
> 
> That's a nice idea: perl's implicit use of local variables is not its
> most delightful feature, in my view. :-)
> 
> The thing is that PUSHSUB already uses 'cv' implicitly. I could write

That's a point. In that case, I'd be tempted to leave PUSH_MULTICALL as-is
rather than doing fancy tricks.

> > * pp_sort() isn't using these macros. Will this change later, or are there
> > reasons why it can't?
> 
> One issue is that pp_sort() doesn't necessarily have a CV. If you
> use a sort block, like  sort { f($a) cmp f($b) } @foo , then the
> code for the block just sits in the optree rather than its own CV.

I haven't looked closely at the code, but wouldn't it be poossible to
factor out the common code into a macro (which needn't be part of the
public API then have) the public macros use them, eg

#define PUSH_MULTICALL \
    ....
    PUSH_MULTICALL_OP(CvSTART(cv)) \
    ....

(he says vaguely handwaving).

-- 
In defeat, indomitable; in victory, insufferable
    -- Churchill on Montgomery

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