On Aug 27, 9:00 am, Phrogz <phr... / mac.com> wrote: > On Aug 27, 9:13 am, Trans <transf... / gmail.com> wrote: > > > Has anyone else every wished #p would passthru it's argument? Ie. Work > > like this: > > > def p(x) > > puts x.inspect > > x > > end > > I can't recall ever wanting that. (Though I did find it odd that it, > and puts, return nil for no seemingly good reason.) > > Have *you* wished that, Trans? If so, I'd be interested in your use > case. Oh yes, lots of times. When I'm debugging code I sometimes want to see the state of an object, but I don't want to mess with the execution. With complex statements this isn't always straight forward. For instance, def foo(x) bar(baz(x)) end If I want to see the result of baz(x), I'd need to change it to something like: def foo(x) p(r = baz(x)) bar(r) end But if #p passed thru, it's simply: def foo(x) bar(p(baz(x))) end T.