On 2 July 2013 13:47, Nicholas Clark <nick@ccl4.org> wrote: > > On Tue, Jul 02, 2013 at 01:41:20PM +0200, Rafael Garcia-Suarez wrote: > > On 27 June 2013 03:59, Ricardo Signes <perl.p5p@rjbs.manxome.org> wrote: > > > Also $href->%* I suppose. > > Can we talk about failure modes a bit? > > A common idiom is to write @{ $foo || [] } in case $foo might be undefined. > > Do you remember the conditional-dereference operator that was > > bikeshedded to oblivion? ($foo?->bar() was one of the proposed > > syntaxes). Can we have this, plus ->@*, plus ?->@* that would expand > > to an empty list if its argument is undef? > > Ultimately it wasn't bikeshedded to oblivion. > > rjbs attempted to restart things, asking questions about how it was supposed > to work, independent of its spelling, in certain unconsidered situations, > such as LVALUE context. Fair enough, I forgot about that episode. It was warnocked into oblivion then :) > No-one answered. > > And that question is actually relevant. What would this do for undefined > $foo? > > $foo->@* = @bar; > @bar = $foo->@*; > > > Presumably for what you're suggesting, in LVALUE context, $foo autovifies. > In RVALUE context it does not (but does not error either) @$foo autovivifies in LVALUE context, but errors in RVALUE context (if $foo is undef). I don't think ->@* should have different semantics. Or did you mean to ask the question about ?->@* ?Thread Previous | Thread Next