----- Original Message ----- 
From: "Hal E. Fulton" <hal9000 / hypermetrics.com>
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Friday, September 20, 2002 3:30 PM
Subject: Re: String interpolation at will?


> Hmm, there have been times I wished for a String.interpolate
> method... couldn't be too hard to expose it. Wonder if it's
> worth it?

To reply to myself: I've just remembered why
this is nontrivial in pure Ruby. If you write 
a String#interpolate, it can't get to your
local variables, i.e. if you do:

  bar = "secret"
  foo = 'code is #{bar}'
  str = foo.interpolate

it won't work because #interpolate can't see
the bar variable. Hmm.

You can still do it outside of a method, of 
course.

I'm playing with a Proc now out of curiosity.

Hal