On Wed, Nov 20, 2002 at 02:46:22PM -0800, Michael Lazzaro wrote:
: On Wednesday, November 20, 2002, at 01:45  PM, Tanton Gibbs wrote:
:     string interpolation? (where we need it most!)
I agree.  But it's already there.  We can interpolate method calls.

:     "\$i is $(sprintf('%04x',$i))"

Assuming we've already got the approapriate universal method defined,
we can already do one of these:

    "\$i is $i.format('%04x')"
    "\$i is $i.form('%04x')"
    "\$i is $i.frm('%04x')"
    "\$i is $i.as('%04x')"
    "\$i is $i.f('%04x')"

In theory we could even put in some syntactic sugar like this:

    "\$i is $i.%04x"

Presumably that sort of thing could work outside quotes as well:

    $i = 255.%04x;

But that's kind of out there, and I'm not sure the syntax generalizes
well enough in real life, since the % can't introduce a token in
isolation.  You'd like to be able to say things like

    $i ~~ %04x

too, and that's not syntactically feasible.  So just assume there's
a method for now.  I'm kinda partial to $i.as() myself.  We can sugar
it later.

Larry

Reply via email to