<story><title>“Did you mean?” Experience in Ruby</title><url>http://www.yukinishijima.net/2014/10/21/did-you-mean-experience-in-ruby.html</url></story><parent_chain><item><author>derefr</author><text>A lot of people are recommending IDE-like tooling--but in truly dynamic language (one with a &amp;quot;living image&amp;quot; with path-dependent monkey-patched behavior that can&amp;#x27;t be replicated during static analysis, like Smalltalk--or, sometimes, Ruby) there&amp;#x27;s a more idiomatic way.&lt;p&gt;In a dynamic language, if you&amp;#x27;re at all unsure of what code you need to write, then you &lt;i&gt;don&amp;#x27;t write it in your editor in the first place.&lt;/i&gt; Instead, you build the expression you need, interactively, at the REPL—and then, once it works, you paste that &lt;i&gt;into&lt;/i&gt; your editor.&lt;p&gt;In dynamic languages, the &amp;quot;dead&amp;quot; code in modules is effectively a coagulation of previously &amp;quot;live&amp;quot; REPL incantations; to trust code that was written &amp;quot;dead&amp;quot; to work correctly &amp;quot;live&amp;quot; is madness (or just a recipe for really long iterations involving unit tests.)&lt;p&gt;If you take this approach far enough, though, you do get a sort of IDE—something that manages your expression experiments and the context harnesses they need, and re-runs experiments when you edit their dependent formulae. I am, of course, talking about &amp;quot;notebook&amp;quot; interfaces like IPython&amp;#x27;s.</text></item></parent_chain><comment><author>vidarh</author><text>And with Ruby, especially since you mention Smalltalk, we have a tool that is getting &lt;i&gt;closer&lt;/i&gt; to the kind of live introspection and modification that Smalltalk is famous for: Pry [1].&lt;p&gt;Pry lets you call &amp;quot;binding.pry&amp;quot; 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&amp;#x27;t work, for example. Letting me inspect the environment, modify stuff, and when I exit the request is completed.&lt;p&gt;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.&lt;p&gt;And you can attach to it remotely using Drb in case the app in question doesn&amp;#x27;t run attached to a terminal.&lt;p&gt;At this point it&amp;#x27;s almost criminal to do Ruby development without Pry.&lt;p&gt;[1] &lt;a href=&quot;http://pryrepl.org/&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;pryrepl.org&amp;#x2F;&lt;/a&gt;</text></comment>
<story><title>“Did you mean?” Experience in Ruby</title><url>http://www.yukinishijima.net/2014/10/21/did-you-mean-experience-in-ruby.html</url></story><parent_chain><item><author>derefr</author><text>A lot of people are recommending IDE-like tooling--but in truly dynamic language (one with a &amp;quot;living image&amp;quot; with path-dependent monkey-patched behavior that can&amp;#x27;t be replicated during static analysis, like Smalltalk--or, sometimes, Ruby) there&amp;#x27;s a more idiomatic way.&lt;p&gt;In a dynamic language, if you&amp;#x27;re at all unsure of what code you need to write, then you &lt;i&gt;don&amp;#x27;t write it in your editor in the first place.&lt;/i&gt; Instead, you build the expression you need, interactively, at the REPL—and then, once it works, you paste that &lt;i&gt;into&lt;/i&gt; your editor.&lt;p&gt;In dynamic languages, the &amp;quot;dead&amp;quot; code in modules is effectively a coagulation of previously &amp;quot;live&amp;quot; REPL incantations; to trust code that was written &amp;quot;dead&amp;quot; to work correctly &amp;quot;live&amp;quot; is madness (or just a recipe for really long iterations involving unit tests.)&lt;p&gt;If you take this approach far enough, though, you do get a sort of IDE—something that manages your expression experiments and the context harnesses they need, and re-runs experiments when you edit their dependent formulae. I am, of course, talking about &amp;quot;notebook&amp;quot; interfaces like IPython&amp;#x27;s.</text></item></parent_chain><comment><author>pjmlp</author><text>Funny that you mention Smalltalk, because of its image model, completion usually works quite well.&lt;p&gt;I remember using it on my Smalltalk days at the university in 1996.</text></comment>