Joseph F. Ryan: # By default, references should not stringify to anything # "pretty", they should stringifiy to something useful for # debugging. Heck, even perl5 style should be fine. Not only
Why? Isn't the pretty form more generally useful? # is this handy, but also prevents problems with circular # referencing data structures, huge data structures, etc. # However, all built-in types should have a .repr() method, # which should provide primitive Data::Dumper-ish output # # So: # # $var = [1,2,3]; # print "$var"; # print "\n"; # print "$($var.repr)"; # # Might print something like: # # [REF_TO_ARRAY_AT: '0x1245AB'] What's wrong with a Perl 5-esque format for the debugging version? Array(0x1245AB) Personally, I like this format. It's succinct, informative, and tells you enough to do identity testing. # Next, objects: # # Objects should have an AS_STRING method inherited from # UNIVERSAL defined as follows: I'd prefer if we drop the capitals. str() ought to work fine, IMHO. # method AS_STRING() { # return "[CLASS_INSTANCE_OF: '" ~ $self.CLASS() ~ "']"; # } Once again, what's wrong with: method str() { #Unnamed invocant means you need $_, right? return $_.class() ~ "($_.id())"; } (where id() returns a uniquely identifying integer, usually the address). --Brent Dax <[EMAIL PROTECTED]> @roles=map {"Parrot $_"} qw(embedding regexen Configure) "If you want to propagate an outrageously evil idea, your conclusion must be brazenly clear, but your proof unintelligible." --Ayn Rand, explaining how today's philosophies came to be