On Thu, Sep 22, 2005 at 11:59:32AM -0400, Matt Fowles wrote:
> Well said! I completely agree that string interpolation should be
> handled exactly the same as stringification. I would like C< ("foo is
> $foo of course") eq ("foo is " ~ $foo ~ " of course") > at all times.
Yes.
S03 states:
Unary ~ now imposes a string context on its argument, and + imposes a
numeric context (as opposed to being a no-op in Perl 5). Along the
same lines, ? imposes a boolean context, and * imposes a list context.
That seems to indicate that ~$foo eq "$foo".
If however, you want $foo to interpolate to something else, you can do
that in several ways:
"hello { +$foo }"
"hello { $foo.as(...) }"
Or when concatenating:
"" ~ +$foo ~ ""
"" ~ $foo.as(...) ~ ""
-kolibrie