develooper Front page | perl.perl5.porters | Postings from October 2009

Re: [perl #70043] Re: [Sysadmins] Perl allows non-sensical operations on reference converted to an integer

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
October 27, 2009 04:05
Subject:
Re: [perl #70043] Re: [Sysadmins] Perl allows non-sensical operations on reference converted to an integer
Message ID:
20091027110511.GX60303@plum.flirble.org
On Tue, Oct 27, 2009 at 07:00:07AM -0400, David Golden wrote:
> On Tue, Oct 27, 2009 at 6:41 AM, Aristotle Pagaltzis <pagaltzis@gmx.de> wrote:
> > Along similar lines I???d also like to eventualy see it become
> > a fatal error to stringify a reference implicitly, since that
> > often happens by accident and the resulting string is useless
> > in most circumstances, but the silent apparent success of the
> > operation leads to errors only turning up far away from where
> > the stringification (ie. the real mistake) actually happened.
> >
> > I don???t know how popular this opinion is, though.
> 
> To me, it seems consistent with the idea "use strict 'refs'" -- if
> strictures are on, stringifying or numifying a reference should be a
> fatal error.  If someone needs it, they should use refaddr anyway
> because of overloading.  So to clarify, it should be fatal *unless*
> it's a blessed object with numification or stringification
> overloading.

Which breaks existing code that uses strict, and the idiom of using the
stringification of references as hash keys.

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About