develooper Front page | perl.perl6.language | Postings from September 2005

Re: numification and stringification of objects

Thread Previous | Thread Next
From:
Ashley Winters
Date:
September 25, 2005 23:55
Subject:
Re: numification and stringification of objects
Message ID:
cda42dbb05092523545d353b92@mail.gmail.com
On 9/25/05, Juerd <juerd@convolution.nl> wrote:
> Whenever possible, object should have useful numeric and string
> representations. These are generally lossy, but this is not a problem, because
> a scalar stays a scalar even after being used in a certain context, and the
> object isn't lost.

Sounds good. Let me summarize what I've gleaned so far, in the context
of what I was looking for:

Presentation: $object.as(Str, ...) where ... is a format string;
perhaps an sprintf format, or something else. Localization occurs
here. Formatting occurs here.
Timezone/newline-convention/join-character-specification/whatever
happens here

Representation: ~$object eq $object.as(Str) eq DWIMiest string Presentation

Serialization: my Thingy $obj.=thaw($object.freeze)

Interpolation: "foo $object" eq "foo " ~ ~$object

This makes sense, and I can accept it. I still think the proposed
Representation behavior should really be the Interpolation behavior,
and Representation should be a lossless but readable version of
Serialization, though I'm clearly wrong, since I can't defend it. No
worries. I'll come around to see the light. Someday. :)

Ashley Winters

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