|
|
|
|
|
by vidarh
4258 days ago
|
|
And with Ruby, especially since you mention Smalltalk, we have a tool that is getting closer to the kind of live introspection and modification that Smalltalk is famous for: Pry [1]. Pry lets you call "binding.pry" anywhere in your program to dump you into a shell within that context, with full access to local variables etc.. And tab-completion and plenty of introspection features. I frequently find myself triggering Pry in the middle of handling http requests if something doesn't work, for example. Letting me inspect the environment, modify stuff, and when I exit the request is completed. It can also do things (with some limitations) like bring up an editor to where the current method was defined, and let you edit and reload the code. And you can attach to it remotely using Drb in case the app in question doesn't run attached to a terminal. At this point it's almost criminal to do Ruby development without Pry. [1] http://pryrepl.org/ |
|
TBH if I was writing anything large enough for this kind of stuff to get out of hand, I would seriously consider a statically typed language like Golang or C#/F#(which both have absolutely fantastic tooling). REPL's don't help the next person to come along figure out what your methods are taking in and what those calls return. But I digress.
I don't always cut Ruby, but when I do I cut it with Pry... Yeah.