develooper Front page | perl.perl6.documentation | Postings from December 2002

Re: Stringification of references and objects.

Thread Previous | Thread Next
From:
Chris Dutton
Date:
December 6, 2002 12:31
Subject:
Re: Stringification of references and objects.
Message ID:
F21F4CB3-093E-11D7-8948-0005020F8EB9@cmb-enterprises.com
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>


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