Re: Stringification of references and objects.

[email protected] (Chris Dutton) Fri, 6 Dec 2002 12:19:58 -0500
Newsgroups perl.perl6.language,perl.perl6.documentation
Message-ID <[email protected]>
On Friday, December 6, 2002, at 04:28 AM, Joseph F. Ryan wrote:

> Brent Dax wrote
>
>> To tell you the truth, I don't consider arrayrefs references anymore.
>> They're just Array objects that don't happen to be in @whatever 
>> symbols.
>> I don't know if this is the official view, but that fits my brain
>> better.
>>
>
> So you're saying that classes should stringify to a pretty-print of
> their public members?

How about something like what Ruby's irb does?

% irb
irb(main):001:0> class Foo
irb(main):002:1>    def initialize
irb(main):003:2>       @a, @b, @c = 1, 2, 3
irb(main):004:2>    end
irb(main):005:1> end
nil
irb(main):006:0> Foo.new
#<Foo:0x2767a4 @c=3, @b=2, @a=1>
irb(main):007:0>