Brent Dax wrote:
>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?
>
I don't think so; I'd think it to be annoying to have type more code
in order to specify a more cocise form; if I need to dump a structure,
I'd prefer to do it manually.
># 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.
>
>
I like it too, but I thought everyone else hated it :)
># 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).
>
Objects aren't references anymore, are they? So I don't think it is
apporpriate for an object to stringify with its id.
Joseph F. Ryan
ryan.311@osu.edu
Thread Previous
|
Thread Next