On Fri, Oct 21, 2005 at 02:47:54PM +0100, Robin Houston wrote: > On Wed, Oct 19, 2005 at 11:15:10PM +0200, Rafael Garcia-Suarez wrote: > > Thanks, applied as change #25808 to bleadperl. > > Is this a good opportunity to revisit the other related issue: > that of @foo->[0] and %foo->{bar}? > > Someone (I think it might have been me) added a warning at some > point, so this now warns "Using an array as a reference is > deprecated". > > In line with Yitzchak's observation about $#{@foo}, the "correct" > behaviour of @foo->[0] is surely for it to behave like ("".@foo)->[0]. > This is an error under 'use strict', so it would only cause silent > breakage for non-strict scripts -- and the deprecation warning has > been in place since 5.8.0. > > If there's some sort of consensus that this is the right thing > to do, I'm happy to look into implementing it. Turning '@foo->[0]' to mean '("".@foo)->[0]' is going to solve what exactly? While I agree that it's better to write '$foo[0]' instead of '@foo->[0]', I doubt anyone writes '@foo->[0]' if they want '("".@foo)->[0]'. One of the features of Perl is it's DWIM. '@foo->[0]' does what people mean. I don't see any gain in breaking that. AbigailThread Previous | Thread Next