Jonathan Scott Duff wrote:
> On Thu, Dec 20, 2007 at 07:58:51AM -0500, Mark J. Reed wrote:
>> I think the issue is that bare vars don't interpolate anymore, but
>> they still have sigils of their own, so adding to the default interp
>> syntax is too noisy:  ${$var} is not really much improvement over
>> ${\(expr)}.
> 
> That's not quite accurate.  Scalars interpolate as they always have, but
> aggregates need to be followed their respective bracketing construct
> (e.g., "My array contains these items: @array[]")
> 
> The only "issues" that I see from the original email are:
>     1. interpolating scalars but not code
>     2. having to be more careful about what type of string you're using
> 
> Adriano answered #1 I think:  $yaml = Q:!c"{ $key: 42 }";
> 
> For the second one, if you're really just worried about how prevalent {}
> appear in double-quotish strings, perhaps @Larry could be persuaded to
> make them non-interpolative by default. (i.e., the adverb would be
> required to make them interpolate)

That pretty much sums up my concern.

The gyrations to turn off interpolating code... it's nice to know that exists
but not something I want to ever have to remember or type or even consider my
quoting context.  "Interpolate" vs "not interpolate" is enough, I have more
important things to worry about while coding. [1]

Non-interpolative by default... well I don't exactly want the feature to go
away either. [2]  I can see its uses [3] and it potentially eliminates some
otherwise convoluted bits of code.  And again, I don't want to be thinking
about flipping interpolation features on and off for each string.  Even qs//
is more than I want to consider. [4]

Code execution in a string is a very powerful thing, so it's not the sort of
thing one wants to accidentally trigger.  Because it's using a common,
innocent construct, this strikes me as being all too easy to trigger
accidentally and unknowingly.

$ pugs -wle 'sub key() { 42 } sub value() { 23 }  say "{ key: value }"'
23

Whoops.

It's also worth noting that ${} and @{} adding more context flexibility.  It
appears {} only happens in list context right now, though I admit I'm not up
on all the new contexts.


[1] Note, I'm the sort of person that uses "" until I have a reason otherwise.

[2] Now being able to turn it ON in a single quoted string would be handy, but
    that's just because of my special case writing a lot of make generating
    code where $ already has meaning.

[3] Although a lot of them are handled by the interpolation of $obj.method()
    which makes me happy.

[4] Which doesn't appear to be documented in S2.


-- 
Look at me talking when there's science to do.
When I look out there it makes me glad I'm not you.
I've experiments to be run.
There is research to be done
On the people who are still alive.
    -- Jonathan Coulton, "Still Alive"

Reply via email to