> On Tue, Aug 08, 2000 at 02:18:07PM -0000, Perl6 RFC Librarian wrote:
> > Hooks will have to be put in Perl's string context so that if something
> > is an object, then that object's C<STRING> method is called
> > automatically. If no C<STRING> method is defined, then it should simply
> > return undef (instead of printing out the ref/class info).
> 
> I'm not so sure about returning undef here.  Why not fall back to the
> default behaviour of Perl 5 without overload q{""} magic?  As in, return the
> stringified reference.

The problem here is akin to what Andy Dougherty mentioned to me in a
private email: What if the $object doesn't contain appropriate string
data, but perhaps image data?

Because of this, I think the correct approach is this line from the RFC:

    print "$object";

  should always return something that's worth seeing, even if
  that's nothing.

> > If people want to see the ref info, they can still type:
> >
> >    print $object;
> 
> As Bart Lateur (who I've been meaning to thank for pointing it out, thanks!)
> pointed out, the object there -is- stringified; use overload q{""} magic is
> called.

This was a major goof, which I thought I fixed. I meant to say:

   print ref $object;

However, as you point out, there's no easy way to get the HASH(addr)
part. If this RFC is accepted, we might need a special function for that
(but I say stick it in Data::Dumper).

-Nate

Reply via email to