Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112014-11-26T16:12:04ZRuby Issue Tracking System
Redmine Ruby master - Feature #10549 (Open): Deprecate each_with_index and each_with_object in favor of w...https://bugs.ruby-lang.org/issues/105492014-11-26T16:12:04Zdanielmorrison (Daniel Morrison)daniel@collectiveidea.com
<p>I wonder if we can deprecate <code>each_with_index</code> and <code>each_with_object</code> and fully recommend <code>with_index</code> and <code>with_object</code> instead.</p>
<p>I personally like the shorter forms because they hint that they can be used with more methods than simply <code>each</code>. People don't need to ask if there's a <code>map_with_index</code> method, they can just try chaining it the same way and it works! I realized this when teaching new Rubyists, because they often ask those questions.</p>
<p>There is a negligible performance hit.</p>
<p>Lots of code uses <code>each_with_index</code> but it is a one-character change to use <code>each.with_index</code> instead.</p>
<p>Forgive me if this has been brought up recently, but I couldn't find any discussion on it.</p> Ruby master - Misc #10541 (Open): Remove shorthand string interpolation syntaxhttps://bugs.ruby-lang.org/issues/105412014-11-25T16:15:58Zdanielmorrison (Daniel Morrison)daniel@collectiveidea.com
<p>I would like to see the shorthand string interpolation syntax, "foo#@bar" deprecated and then removed in 3.0.</p>
<p>My reasons:</p>
<ol>
<li>Most experienced Ruby developers I've talked to don't even know it exists.</li>
<li>It has been the cause of real problems. <a href="http://status.cloudamqp.com/incidents/vj62pnp62tj9" class="external">http://status.cloudamqp.com/incidents/vj62pnp62tj9</a>
</li>
</ol>
<p>When a syntax is not widely known and has the potential for problems, I think it makes sense to deprecate and remove.</p>