> Date: Sat, 30 Nov 2002 18:51:02 -0800 > From: Michael Lazzaro <[EMAIL PROTECTED]> > > Alternatively, there could perhaps be a marker such that prettyified is > the default, but you can still get 'internal' stringification: > > print "Hello, $personObj"; # normal stringification > print "Person: *$personObj"; # 'internal' stringification > > Or 'internal' stringification can be a method call upon the var: > > print "Person: $personObj.debug";
I like that the best. That could go in the C<Object> (or C<UNIVERSAL> or whatever) and print out something nice for debugging. I was thinking of just the Perl 5 behavior, as: print "Array: @ar"; # pretty print "Array: \@ar"; # debug But that has the problem of large data structures only printing out one level, regardless of whether you want it to be pretty. It's really a tough question of what should be the default. There's the possibility of having both @ar.debug and @ar.serialize, but which should ordinary stringification do? I'd say a nice serialization, to parallel numbers. Numbers always print themselves in a form that is readable, but always entirely retrievable when read back in. Same with strings. So arbitrary data structures should hold together this way too. Yes, that's my favorite at the moment. Serialize on stringify (unless it's overloaded to do something else), and print "useful" debug information on a .debug method call. Debugging an array just one level deep isn't that bad either: print map { .debug } @ar; Hmm.. Luke