On Wed, Aug 09, 2000 at 08:37:35AM -0700, Nathan Wiger wrote:
> > I think a stringified reference is worth seeing, moreso than a simple undef,
> > for debugging purposes if nothing else.
> 
> Debugging is great, but I don't think this is the way to do it. The
> reason is some objects might have a STRING method while others don't, so
> you'll only get partial access to some of the objects' underlying
> structures.
> 
> I think a separate call that dumped the info (basically what print
> $object does now) is better. That way you're guaranteed to get it.

I'm not talking about intentional debugging.  I'm talking about a common
mistake I've often seen and occasionally done: using an object or reference
as a string because of an expected automatic deref, or some sort of magic. 
Seeing the stringified ref rather quickly points out the problem; seeing
undef wouldn't.  This is, of course, assuming there's no STRING method for
the object, in which case there is no bug, using the object as a string is
valid.

I guess my argument is that rather than not show anything, show something;
rather than show undef, show the stringified reference.  There's no harm in
it, it's what's expected, and it's a little more meaningful than undef. 
I'll leave it at that.


> And a novice programmer isn't confused by seeing "HASH(0xe3902)" when
> they expected to see some type of "real" data.

Well, generally novice programmer's -are- confused.  They're usually
expecting an automatic deref, and they get this funky string.  But that's
neither here nor there, unless you're also proposing we have a way of
overloading normal reference stringification.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

Reply via email to