* Father Chrysostomos <sprout@cpan.org> [2013-08-14T12:03:29] > Ricardo Signes wrote: > > « $x->@* acts exactly like @$x » is the rule. "Except in interpolation" would > > be the exception. > > So we allow "$x->@*" and "$$x->@*" and "$x->$*->@*". > > What about the brace forms? How far does the equivalance of "@{...}" > and "...->@*" hold? > > "@{$foo}" --> "$foo->@*" # 1 > "@{$foo[0]}" --> "$foo[0]->@*" # 2 > "@{*$foo}" ??? # 3 > "@{$foo->**}" --> "$foo->**->@*" # 4 > "@{$foo->()}" --> "$foo->()->@*" # 5 > "@{$foo++}" --> "$foo++->@*" # 6 > "@{$foo ? bar() : []}" => "$foo ? bar() : []->@*" # 7 We allow ->@* at the end of an expression that we would've allowed up to that point. Of your examples above, which I've taken the liberty of numbering, #1 and #2 qualify. Of the rest, none do. So far, I don't feel like I've seen a real argument that this is complicating the language. From my thready knowledge of the guts here, I also think the changes to the internals are pretty minor, but I'm happy to be proved wrong. That said, I have softened just a little because I got to thinking that what we'd really benefit from is a generic "interpolate this expression" syntax, which is in Ruby as "foo #{ expr } bar" or the same in Perl 6 without the octothorpe. In Perl 5, of course, we have this in a sense: "foo @{[ expr ]} bar" and "foo ${\ expr } bar". Possibly that's as good as it gets, since such a syntax would need to either force one context or have two forms. And either way, it's circumfix. So: "@{ $foo->[0] }" isn't so bad; generic interpolation form We lose more simplicity with: "@{ $foo }[0,2]" vs. "$foo->@[0,2]" ...because the idea that "@{...}" is "generic interpolation" no longer holds together. -- rjbsThread Previous | Thread Next