Aleksi Niemel<zak / ale.cx> wrote: > >On Sat, 17 Feb 2001, Ben Tilly wrote: > > > Oh, if I am going to make requests, I would also like it > > if "#foo" was syntactic sugar for "#{foo}". (Just to stop > > people complaining that interpolation requires 2 extra > > characters.) > >Let's take a look at this: > >ruby -v -e'a="b"; $c="d"; @e="f"; def g; "h"; end; puts "#a #$c #@e #g";' >ruby 1.6.2 (2000-12-25) [i686-linux] >#a d f #g > >So #$foo and #@foo are already syntactic sugar. I'm not sure I really >need to get #foo to be #{foo}. Combination of '#' and a special char >happens much rarely accidentally whereas plain '#' happens quite >often. It would be nice of course, as Perl shows. And in my experience >there isn't mess too often. I listed it because it is a complaint I have seen. >However, I'm sure it would break bunch of scripts, which currently >just print innocent comments and in the future interpolate variable or >method calls. Certainly it is not backwards compatible. Personally I had not carefully considered the fact that it would interpolate method calls. I think that it would be sufficient to satisfy complaints if a pattern matching /#(\w+)\b/ would only interpolate when $1 was a variable in scope. (A limitation that would eliminate most accidental interpolations.) Cheers, Ben _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com