At 17:28 07/06/2004 +0900, you wrote:

>"Richard Lionheart" <NoOne / Nowhere.com> schrieb im Newsbeitrag
>news:9aKdnRz0R5mAj17dRVn-jg / comcast.com...
>> Hi,
>>
>> For debugging purposes,  I'd like to write a routine to dump a variables
>> name and value, sort of like Object#inspect but different.  I'd like to
>> write:
>>
>> def dumpv(var)
>>     $stdin.print var.name + ' = "' + v.to_s + "\"\n"
>>     $stdin.flush
>> end
>
>Btw: you didn't mean to use $stdin for printing, do you?
>
>def dumpv(varname, env)
>  print varname.to_s, ' = "', eval(varname.to_s, env), "\"\n"
>end
>
>v1 = 'abc'
>dumpv :v1, binding
>
>Regards
>    robert

This was mentionned before:

def dumpv( &block )
  expr = block.call()
  print expr, ' = "', eval( expr, block), "\"\n"
end

v1 = 'abc'
dumpv{ :v1}

That the same but thanks to the fact that a Proc is an OK binding
for eval... you avoid the extra binding parameter.

Yours,

JeanHuguesRobert

-------------------------------------------------------------------------
Web:  http://hdl.handle.net/1030.37/1.1
Phone: +33 (0) 4 92 27 74 17