Print out a variable's name and value?

Hello,

I want a comfortable debug function to which I can pass a variable, and
it writes out the variable’s name and value. Can I accomplish this?

If I could manipulate the calling stack as bindings, and could get the
binding of the caller, then I could pass the variable’s name (e.g. as
debug(:x)), and make it’s name and value printed.

If I have to write debug(:x,binding()), then instead I write
debug(:x,x). :-)) And I will be sad that I cannot use CPP on ruby
source. :slight_smile:

Circum

PS: As you can see, it is rather a theorethical problem… :slight_smile: