https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112010-10-19T11:30:10ZRuby Issue Tracking SystemRuby master - Feature #3963: Map class in standard libraryhttps://redmine.ruby-lang.org/issues/3963?journal_id=138252010-10-19T11:30:10Zshyouhei (Shyouhei Urabe)shyouhei@ruby-lang.org
<ul></ul><p>=begin<br>
FYI: There has been a Mash merge request about a year ago. Pleas take a look at<br>
<a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/26492" class="external">http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/26492</a><br>
and its followups.<br>
=end</p> Ruby master - Feature #3963: Map class in standard libraryhttps://redmine.ruby-lang.org/issues/3963?journal_id=138322010-10-20T21:44:13Zrklemme (Robert Klemme)shortcutter@googlemail.com
<ul></ul><p>=begin<br>
On Tue, Oct 19, 2010 at 4:34 AM, Shyouhei Urabe <a href="mailto:redmine@ruby-lang.org" class="email">redmine@ruby-lang.org</a> wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-2 status-6 priority-4 priority-default closed" title="Feature: Map class in standard library (Rejected)" href="https://redmine.ruby-lang.org/issues/3963">#3963</a> has been updated by Shyouhei Urabe.</p>
<h2>FYI: There has been a Mash merge request about a year ago. Pleas take a look at<br>
<a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/26492" class="external">http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/26492</a><br>
and its followups.</h2>
<p><a href="http://redmine.ruby-lang.org/issues/show/3963" class="external">http://redmine.ruby-lang.org/issues/show/3963</a></p>
</blockquote>
<p>Especially <a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/26513" class="external">http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/26513</a><br>
I'd say. I think Matz hit the nail on the head here. After all,<br>
there are Symbol#to_s, String#to_s, Symbol#to_sym and String#to_sym<br>
which make conversion a nobrainer if it is needed.</p>
<p>Cheers</p>
<p>robert</p>
<p>--<br>
remember.guy do |as, often| as.you_can - without end<br>
<a href="http://blog.rubybestpractices.com/" class="external">http://blog.rubybestpractices.com/</a></p>
<p>=end</p> Ruby master - Feature #3963: Map class in standard libraryhttps://redmine.ruby-lang.org/issues/3963?journal_id=140452010-11-05T03:19:42Ztrans (Thomas Sawyer)
<ul></ul><p>=begin<br>
I can't check that post b/c service is down :(.</p>
<p>But I would argue that a class like this goes much further than key conversions. One wants to prevent any other key types from being used at all.</p>
<p>(Also, I want follow up that Ara's Map class might not be the best choice. I think maybe he's added too many "extra features", like OpendStruct-like lookup/. Maybe Mash is a better implementation? But I do like the name Map.)<br>
=end</p> Ruby master - Feature #3963: Map class in standard libraryhttps://redmine.ruby-lang.org/issues/3963?journal_id=250992012-03-25T14:24:13Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/25099/diff?detail_id=18388">diff</a>)</li><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>akr (Akira Tanaka)</i></li></ul> Ruby master - Feature #3963: Map class in standard libraryhttps://redmine.ruby-lang.org/issues/3963?journal_id=251002012-03-25T14:24:51Zakr (Akira Tanaka)akr@fsij.org
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Rejected</i></li></ul><p>I think no hope to add Map class as builtin.</p> Ruby master - Feature #3963: Map class in standard libraryhttps://redmine.ruby-lang.org/issues/3963?journal_id=251862012-03-27T00:53:19Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul></ul><p>Hello,</p>
<p>2012/3/25, akr (Akira Tanaka) <a href="mailto:akr@fsij.org" class="email">akr@fsij.org</a>:</p>
<blockquote>
<p>I think no hope to add Map class as builtin.</p>
</blockquote>
<p>I agree for two reasons.</p>
<p>The name "map" is not suitable. In computer science, "map" stands for<br>
an abstract data structure that preserves correspondence between a key<br>
and a value. See: <a href="http://en.wikipedia.org/wiki/Associative_array" class="external">http://en.wikipedia.org/wiki/Associative_array</a><br>
Hash, binary tree, and "Ara Howard's Map" are all instances of map.<br>
So the name is too general for the library.</p>
<p>In addition, standard libraries are basically shrinking. It is hard<br>
to add a new library except a good reason.</p>
<p>--<br>
Yusuke Endoh <a href="mailto:mame@tsg.ne.jp" class="email">mame@tsg.ne.jp</a></p> Ruby master - Feature #3963: Map class in standard libraryhttps://redmine.ruby-lang.org/issues/3963?journal_id=251972012-03-27T01:49:31Ztrans (Thomas Sawyer)
<ul></ul><p>Just to be sure, I think I should clarify.</p>
<p>I do not mean Ruby ought provide Ara's Map class specifically (though, for the most part it is probably a very good implementation which is why I reference it). But that Ruby provide at least some sort of "Hash with indifferent access" out of the box. In other words, a Hash class that only allows for "text keys" (whether they are symbols or strings under the hood, doesn't matter).</p>
<p>The thing is, more often than not, that is the way we tend to use a Hash. For example, named parameters for methods optimally would use a Hash that makes no distinction String vs Symbol keys.</p>
<p>I figured that a new class is the most likely to be accepted, but I will point out, this could be addressed in another way. If Hash itself supported a key casting procedure, akin to the default value procedure, then we could do something like:</p>
<p>h = Hash.new<br>
h.convert_key{ |k| k.to_sym }</p>
<p>h['a'] = 1<br>
h #=> {:a => 1}</p>
<p>If we could do that, then there would be no need of an alternate class. And this would be a much more flexible approach too. But, as I said, I suspect this has less chance of acceptance b/c I suspect it would be problematic implementation wise. For that reason I proposed having the a new class in standard library.</p> Ruby master - Feature #3963: Map class in standard libraryhttps://redmine.ruby-lang.org/issues/3963?journal_id=252002012-03-27T02:20:39Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul></ul><p>Did you read the thread Shyouhei said?</p>
<p>shyouhei wrote:</p>
<blockquote>
<p>FYI: There has been a Mash merge request about a year ago. Pleas take a look at<br>
<a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/26492" class="external">http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/26492</a><br>
and its followups.</p>
</blockquote>
<p>I don't remember it in detail, but a similar idea you are talking about<br>
was discussed, I guess.<br>
Please explain how your idea differs from the old discussion if any.</p>
<p>--<br>
Yusuke Endoh <a href="mailto:mame@tsg.ne.jp" class="email">mame@tsg.ne.jp</a></p> Ruby master - Feature #3963: Map class in standard libraryhttps://redmine.ruby-lang.org/issues/3963?journal_id=252052012-03-27T02:32:06Ztrans (Thomas Sawyer)
<ul></ul><p>Not much difference, except perhaps for the more flexible #convert_key idea. I was just clarifying in this ticket b/c of some of the comments made about Map specifically.</p>
<p>The conversation referenced did not seem to have any kind of conclusion. I see that matz indicated a preference for a possible "compare by string" directive. So maybe #convert_key is not such a bad notation as I thought?</p> Ruby master - Feature #3963: Map class in standard libraryhttps://redmine.ruby-lang.org/issues/3963?journal_id=252072012-03-27T02:42:19Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Rejected</i> to <i>Assigned</i></li><li><strong>Assignee</strong> changed from <i>akr (Akira Tanaka)</i> to <i>matz (Yukihiro Matsumoto)</i></li></ul><p>Okay, thanks. I mark this ticket as matz's issue.</p>
<p>--<br>
Yusuke Endoh <a href="mailto:mame@tsg.ne.jp" class="email">mame@tsg.ne.jp</a></p> Ruby master - Feature #3963: Map class in standard libraryhttps://redmine.ruby-lang.org/issues/3963?journal_id=257992012-04-10T18:51:13Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Rejected</i></li></ul><p>I reject the original idea of Map inclusion to the core. Map and Hash are too similar.</p>
<p>Matz.</p>