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

Re: numification and stringification of objects

Thread Previous
From:
Stuart Cook
Date:
September 26, 2005 02:10
Subject:
Re: numification and stringification of objects
Message ID:
49b3510605092602107ed8b6fe@mail.gmail.com
On 26/09/05, Yuval Kogman <nothingmuch@woobling.org> wrote:
> On Sun, Sep 25, 2005 at 23:54:56 -0700, Ashley Winters wrote:
> > Localization occurs here. Formatting occurs here.
> > Timezone/newline-convention/join-character-specification/whatever
> > happens here
>
> This is going too far, IMHO.

I can't speak for Ashley, but when I read that I assumed it meant things like:

  $num    .as(Str, :scientific);
  $message.as(Str, :locale<ja-JP>);
  $date   .as(Str, :calendar<Hebrew>);
  $pair   .as(Str, :join< >);

Which you'll probably agree is a lot more sane.

> What I definately won't mind is a module that exports a lexical
> &*prefix:<~> (and thus otherwise augments interpolation) so that any
> stringification in a certain block of code is localized.

  {
    # (The details might not be 100% accurate, but the intent should
    #  be clear.)

    temp &*prefix:<~> .= assuming(:locale<en-GB>);

    say $message;                          # localizes
    say $message.as(Str, :locale(undef));  # default behaviour
  }

Something along those lines, anyhow.


Stuart

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About