From: Ben Giddings Date: 2007-10-19T23:27:23+09:00 Subject: Re: the level of Ruby programmers vs PHP's On Oct 19, 2007, at 04:32, SpringFlowers AutumnMoon wrote: > print_debug($foo) > > will print > > $foo is 3 > > so if i have 20 expressions, > > like > > print_debug(2**3) > print_debug(8**(1.0/3)) > print_debug(a + 2.038) > [...] > > it will print out the expression as well as the value at the same > time, > as a convenience for testing and for debugging. This is one of the few reasons I wish Ruby had macros. Having a macro like this can be very useful, but it isn't possible with a function/method because the argument gets evaluated before being passed to the context of the function/method. In the above examples print_debug would be passed 3, 8, 2.0 and some float value. I don't know if it would be possible to have some special macroish functionality in Ruby that would allow "print_debug()" but not open the can of worms that is macros. Ben