https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112015-01-26T16:39:44ZRuby Issue Tracking SystemRuby master - Misc #10783: String#concat has an "appending" behaviorhttps://redmine.ruby-lang.org/issues/10783?journal_id=512242015-01-26T16:39:44Zsawa (Tsuyoshi Sawada)
<ul></ul><p>I can't find the place in the documentation that says "Concatenation (aka +)". Is this your own claim? If so, then that is not correct.</p> Ruby master - Misc #10783: String#concat has an "appending" behaviorhttps://redmine.ruby-lang.org/issues/10783?journal_id=512262015-01-26T18:20:32Zas-cii (Antonio Scandurra)me@as-cii.com
<ul></ul><p>Tsuyoshi Sawada wrote:</p>
<blockquote>
<p>I can't find the place in the documentation that says "Concatenation (aka +)". Is this your own claim? If so, then that is not incorrect.</p>
</blockquote>
<p>I'll copy over the relevant excerpts.</p>
<pre><code>str + other_str → new_str
Concatenation—Returns a new String containing other_str concatenated to str.
</code></pre>
<pre><code>str << integer → str
str << obj → str
Append—Concatenates the given object to str. If the object is a Integer, it is considered as a codepoint, and is converted to a character before concatenation.
</code></pre>
<p>But then <code>concat</code> is defined as:</p>
<pre><code>concat(integer) → str
concat(obj) → str
Append—Concatenates the given object to str. If the object is a Integer, it is considered as a codepoint, and is converted to a character before concatenation.
</code></pre>
<p>I summarized what I had read in the documentation, therefore it was not an exact quote.</p> Ruby master - Misc #10783: String#concat has an "appending" behaviorhttps://redmine.ruby-lang.org/issues/10783?journal_id=512282015-01-26T20:15:29Zsawa (Tsuyoshi Sawada)
<ul></ul><p>I see. You are assimilating the ordinary word "concatenation" with the Ruby method name <code>concat</code>. They are different. But I agree that the documentation is misleading. It should avoid such confusing wording.</p> Ruby master - Misc #10783: String#concat has an "appending" behaviorhttps://redmine.ruby-lang.org/issues/10783?journal_id=733632018-08-08T03:08:34Zioquatix (Samuel Williams)samuel@oriontransfer.net
<ul></ul><p>I also agree that this is confusing, and the only way to fix it would really be to rename <code>concat</code> to <code>append</code>. There is a proposal for something like this here: <a href="https://bugs.ruby-lang.org/issues/14033" class="external">https://bugs.ruby-lang.org/issues/14033</a></p>