> Mark Jason Dominus wrote:
> > I have been thinking about this for a long time, and it has often
> > seemed to me that "strict refs" was not as helpful as it could be.
>
> I agree with the problem you've outlined, in theory, but I worry about one
> thing...
I agree that it is worrisome.
> Now instead of:
>
> print "Blah blah $foo blah blah";
>
> I need:
>
> printf "Blah blah %s blah blah",
> ref $foo ? ref2string($foo) : $foo;
>
> Or I risk a run-time error.
You could make the same argument about dereferencing. How about it?
You want to write
$n_elements = @$aref;
but if you are using "strict refs" you have to put instead:
$n_elements = ref($aref) ? @$aref : .... ;
or you risk a run-time error.
But presumably you don't do this, and you don't let it prevent you
from using "strict refs" either. So why are the two situations
different? (This is not a rhetorical question.)
Thread Previous
|
Thread Next