in reply to Re: Undocumented join() feature, now defunct? (optimization)
in thread Undocumented join() feature, now defunct?
Thank you for your reply but I think you might have misunderstood the direction I'm coming from. I was not attempting to write code to exploit an undocumented, or unclearly documented, feature of join. Rather, I was going to write an equivalent function that did allow for an EXPR that evaluates more than once. The discovery that earlier versions of join also did this was purely by chance.
Then you should probably adjust (and loosen) your expectations
My expectation was based on the wording of the documentation which does not explicitly state that EXPR could be evaluated more than once.
then you've written code that is likely to break when an optimization gets done.
To my mind, an optimization improves performance but does not alter behaviour. A bug fix alters behaviour. I should, of course, have read perl5180delta before writing the OP. In it under "Selected Bug Fixes" we find
join and "@array" now call FETCH only once on a tied $" [perl #8931].
This answers my question: the behaviour was considered to be a bug which has now been fixed. Anonymonk's reply informs us that it was "a bug fixed by accident" as part of an optimization but perhaps the documentation ought to clarify the behaviour and how it has now changed.
I should add that none of this was for production code but was just playing around exploring language features.
Cheers,
JohnGG
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Undocumented join() feature, now defunct? (expect)
by tye (Sage) on Oct 31, 2014 at 04:37 UTC | |
by ikegami (Patriarch) on Nov 02, 2014 at 20:48 UTC | |
by tye (Sage) on Nov 02, 2014 at 22:36 UTC |