develooper Front page | perl.perl5.porters | Postings from December 2007

Re: "strict refs" not strict enough

Thread Previous | Thread Next
From:
Peter Scott
Date:
December 28, 2007 06:10
Subject:
Re: "strict refs" not strict enough
Message ID:
pan.2007.12.28.14.10.36.556724@PSDT.com
On Fri, 28 Dec 2007 03:08:33 -0500, Mark Jason Dominus wrote:
> I would like to suggest that the real problem here is that references
> should not be implicitly converted to strings.  If converting a
> reference to a string were a fatal error, many or most "strict refs" errors
> would be caught much earlier, at the place they actually occurred,
> instead of far away.

I agree with your suggestion.  I think it should have a separate
subpragma name rather than being convolved with 'refs'.  'refs' is
prohibiting using strings a references.  You are prohibiting using
references as strings.  It's only the likely intent of using a stringified
reference as a reference later that connects the two.  I see 'refs' as
mostly useful for slapping the hand of someone who thinks they need to use
the contents of one variable as the name of another.

Maybe your stricture could be "use strict 'strings'" and turned on with no
argument like the others.

-- 
Peter Scott
http://www.perlmedic.com/


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