On 31 May 2016 at 14:29, B O <perlbug-followup@perl.org> wrote: > # New Ticket Created by "B O" > # Please include the string: [perl #128301] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=128301 > > > > Hi everyone, > > I have spoken to Zefram and TonyC on #p5p, and apparently it's not well > documented in perl which operations will eagerly create hash elements. In > foo(\$x{bla}), for example, the \ is treating its operand as an lvalue, > same as if it were on the lhs of an assignment like that. Now, foo($x{bla}) > *also* treats $x{bla} as an lvalue, but doesn't eagerly create it. Instead, > it passes a PVLV to foo(), which can then create the hash element by > assigning to $_[0]. > > Function arguments are usually taken by value but there's no type > information to say which arguments specifically are taken by reference and > so need the lvalue treatment. This patch adds two extra tests for that > behaviour, so at least we can check whether they remain consistent. While I think its useful to have some kind of testing for this behavior I worry that what you are testing for is accidental or side-effect kind of behaviour of not fully thought through changes, and that by adding tests for it we bake a commitment to treating them as "expected behaviour" when they are not. I am fine if we write a bunch of tests which becomes an assay of the current state of affairs, but once we have the list we should probably discuss whether any of them are controversial or actually bugs which need to be fixed before we commit to them being specific tests. Perhaps some of them should actually be TODO tests of the opposite of what we do now. Hope that makes sense. I do appreciate the thought and effort that went into this. Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"Thread Previous | Thread Next