On Mon, Mar 12, 2007 at 12:56:26PM +0900, Michael Strelnikov wrote: > >I would be interested in hearing what you want to do with text > >substitution that you cannot already do with standard Ruby > >metaprogramming techniques. > > > > > Easy. > Let's we have following function: > * set_default(var, val) > -- if variable "var" is not defined (not existed) then assign value "val" > else do nothing. > > The variable could be ANY type including "Fixnum". > > Try to implement it using standard techniques. Do you really need to abstract out "var ||= val" into its own function? If for some reason you do, then local variables are not the right abstraction. Local variables are statically created when code is parsed (*); local variables are not objects; and you cannot take references to them. Use instance variables on an object instead. Regards, Brian. (*) which means you can create them using "eval", but I'm pretty sure you don't want to do that.