develooper Front page | perl.perl5.porters | Postings from August 2001

Re: [PATCH] C Callbacks, try #3

Thread Previous | Thread Next
From:
Simon Cozens
Date:
August 27, 2001 12:05
Subject:
Re: [PATCH] C Callbacks, try #3
Message ID:
20010827192056.A955@netthink.co.uk
On Fri, Aug 24, 2001 at 04:26:14PM -0500, David M. Lloyd wrote:
> > There was some discussion on #perl a few days ago about lexically
> > scoped runops functions which didn't seem to come up against any
> > compelling reasons why this couldn't or shouldn't be done.
> 
> That sounds neat, but how would you do it?

Hmm. I'd do it by fiddling the op tree. I'd find the nearest last,
(or similar) and do something like this:

    OP* afterlast = last->next;
    last->next = NULL;
    my_runops_function(PL_op);
    PL_op = last;
    last->next = afterlast;

It's similar to the way constant folding works, sort of.

Well, that's how I'd do it. Don't let me stop you doing it another way,
though. :)

Simon

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