develooper Front page | perl.perl5.porters | Postings from October 2017

Re: announcing a new op, OP_MULTICONCAT

Thread Previous | Thread Next
Dave Mitchell
October 26, 2017 07:41
Re: announcing a new op, OP_MULTICONCAT
Message ID:
On Wed, Oct 25, 2017 at 11:48:23PM -0000, Father Chrysostomos wrote:
> Dave Mitchell wrote:
> > On Wed, Oct 25, 2017 at 03:40:15PM -0000, Father Chrysostomos wrote:
> > > If FETCH on a tied $x returns different values each time, does it con-
> > > tinue to behave the same way as currently?
> > 
> > Yes - if a RHS arg is tied, it calls FETCH() for each appearance, and
> > makes a separate mortal copy of each result.
> Oh good.  You seem to be anticipating my devilish attempts to find
> problems with your optimizations. :-)

I've tried very hard to be bug-for-bug compatible with existing behaviour.
See for example this code comment in pp_multiconcat()!

    /* special-case $tied .= $tied.
     * For something like
     *    sub FETCH { $i++ }
     * then
     *    $tied .= $tied . $tied . $tied;
     * will STORE "4123"
     * while
     *    $tied .= $tied
     * will STORE "12"
     * i.e. for a single mutator concat, the LHS is
     * retrieved first; in all other cases it is
     * retrieved last. Whether this is sane behaviour
     * is open to debate; but for now, multiconcat (as
     * it is an optimisation) tries to reproduce
     * existing behaviour.

But no doubt there will be a whole bunch of things I didn't anticipate,
and I look forward to the inevitable slew of BBC tickets.

My Dad used to say 'always fight fire with fire', which is probably why
he got thrown out of the fire brigade.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About