https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17097754782012-07-07T13:18:27ZRuby Issue Tracking SystemRuby master - Feature #6697: [PATCH] Add Kernel#Symbol conversion method like String(), Array() etc.https://bugs.ruby-lang.org/issues/6697?journal_id=278622012-07-07T13:18:27Zsorah (Sorah Fukumori)her@sorah.jp
<ul></ul><p>I can't think any use cases of Kernel.#Symbol, could you tell me the use case?</p>
<p>(Why Kernel.#Symbol makes sense?)</p> Ruby master - Feature #6697: [PATCH] Add Kernel#Symbol conversion method like String(), Array() etc.https://bugs.ruby-lang.org/issues/6697?journal_id=278632012-07-07T15:28:51Zmadeofcode (Mark Dodwell)mark@madeofcode.com
<ul></ul><p>You could make the same argument against String. Why would you use that over <code>#to_s</code>? I can't think of any use cases for that :)</p>
<p>To me, it's really about API consistency. I don't believe you would actually use it frequently, but including it is following the principle of least surprise.</p>
<p>Fwiw. I discovered Symbol did not exist by writing some code to call it, expecting it (since there is String, Array, Hash, etc.) I doubt I'm the only one who's tried calling Symbol, expecting it to exist.</p> Ruby master - Feature #6697: [PATCH] Add Kernel#Symbol conversion method like String(), Array() etc.https://bugs.ruby-lang.org/issues/6697?journal_id=278842012-07-09T15:31:16Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Feedback</i></li></ul><p>String(obj) calls obj.to_str first, then calls obj.to_s.<br>
So they are different.</p>
<p>Integer("foo") raises ArgumentError, but "foo".to_i returns 0.<br>
Array("foo") returns ["foo"], but "foo".to_a raises NoMethodError on 1.9.<br>
Hash(nil) returns {}, but nil.to_hash raises NoMethodError.</p>
<p>So your point about consistency is not reasonable.</p> Ruby master - Feature #6697: [PATCH] Add Kernel#Symbol conversion method like String(), Array() etc.https://bugs.ruby-lang.org/issues/6697?journal_id=316982012-10-27T07:16:59Zko1 (Koichi Sasada)
<ul><li><strong>Assignee</strong> set to <i>mame (Yusuke Endoh)</i></li><li><strong>Target version</strong> changed from <i>2.0.0</i> to <i>2.6</i></li></ul><p>No feedback there.</p> Ruby master - Feature #6697: [PATCH] Add Kernel#Symbol conversion method like String(), Array() etc.https://bugs.ruby-lang.org/issues/6697?journal_id=317962012-10-27T20:12:33Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Assignee</strong> changed from <i>mame (Yusuke Endoh)</i> to <i>matz (Yukihiro Matsumoto)</i></li></ul><p>In Ruby, it is not a good idea to propose something because of consistency.</p>
<p>--<br>
Yusuke Endoh <a href="mailto:mame@tsg.ne.jp" class="email">mame@tsg.ne.jp</a></p> Ruby master - Feature #6697: [PATCH] Add Kernel#Symbol conversion method like String(), Array() etc.https://bugs.ruby-lang.org/issues/6697?journal_id=319042012-10-29T10:53:22Zduerst (Martin Dürst)duerst@it.aoyama.ac.jp
<ul></ul><p>On 2012/10/27 20:12, mame (Yusuke Endoh) wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-2 status-7 priority-4 priority-default closed" title="Feature: [PATCH] Add Kernel#Symbol conversion method like String(), Array() etc. (Feedback)" href="https://bugs.ruby-lang.org/issues/6697">#6697</a> has been updated by mame (Yusuke Endoh).</p>
<p>Assignee changed from mame (Yusuke Endoh) to matz (Yukihiro Matsumoto)</p>
<p>In Ruby, it is not a good idea to propose something because of consistency.</p>
</blockquote>
<p>I guess this should say:</p>
<p>In Ruby, it is not a good idea to propose something <em>only</em> because of<br>
consistency.</p>
<p>Consistency is good, but (as possibly in this proposal) adding a method<br>
just for consistency, without demonstrating an actual need, isn't Ruby<br>
style. So please show some strong uses cases for this method.</p>
<p>Regards, Martin.</p> Ruby master - Feature #6697: [PATCH] Add Kernel#Symbol conversion method like String(), Array() etc.https://bugs.ruby-lang.org/issues/6697?journal_id=688022017-12-25T18:15:06Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Target version</strong> deleted (<del><i>2.6</i></del>)</li></ul>