> Whenever an unhandled exception happens in your program, pry-rescue opens an interactive pry shell right at the point it was raised. Instead of glowering at a stack-trace spewed out by a dying process, you'll be engaging with your program as though it were still alive!
The pry console gives you access to the method that raised the exception, you can use it to inspect the values of variables (no more print statements!), the source code of methods (no more flapping around with a text editor!), and even move up and down the call stack (like a real debugger!).
Basically what we were doing in Smalltalk for decades and trying to tell people about. (To a remarkable degree of push-back and vitriol.) Many years ago, one of our community pointed out that while it lost out as a mainstream platform, Smalltalk actually won the war of ideas. (It's taking quite a long time for everyone else to catch up, however. People keep thinking they've gotten there when they're still a good 1/3rd short.)
Same story as the Lisp folks. Good ideas need to be wrapped up in easy-to-understand, small packages for them to be picked up by the more mainstream languages.
Ruby is pretty much an unholy mix of Perl + Smalltalk + a sprinkling of Lisp with an extreme syntactic sugar-bomb on top to start with. At least in terms of inspirations.
And I say that mostly as a compliment (though I still find the Ruby grammar atrocious from an implementation point of view).
> And I say that mostly as a compliment (though I still find the Ruby grammar atrocious from an implementation point of view).
I think there is something deep embodied here. Syntactic sugar items for languages are like features for libraries. It's been said that if everyone is completely happy with a library's features, the library maintainers haven't been doing their job.
The pry console gives you access to the method that raised the exception, you can use it to inspect the values of variables (no more print statements!), the source code of methods (no more flapping around with a text editor!), and even move up and down the call stack (like a real debugger!).
Basically what we were doing in Smalltalk for decades and trying to tell people about. (To a remarkable degree of push-back and vitriol.) Many years ago, one of our community pointed out that while it lost out as a mainstream platform, Smalltalk actually won the war of ideas. (It's taking quite a long time for everyone else to catch up, however. People keep thinking they've gotten there when they're still a good 1/3rd short.)