------art_30117_83459.1161965517484
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi all,

This isn't nearly as sexy or glamorous as the String <Symbol discussion,
but hey, sometimes it's the little things. ;)

At the moment, the Array#map and Array#map! methods aren't officially
defined as aliases.  This seemingly trivial issue has one current problem
and could potentially lead to issues in the future.

The current (minor) problem is that rdoc doesn't properly document them as
aliases.

The potential problem for the future relates to an idea I had back at
ruby-talk:196740.  If ever we decide to add an Object.aliased_methods method
(or whatever we call it), these methods would not show up.  Then imagine a
scenario where, after implementing Object.aliases_methods, someone
implements a hack so that redefined methods also redefined the aliases, say
through method_added.

BTW, I would have also changed Array#indexes and Array#indices, but they
appear to have some extra warning code, so aren't true aliases.

Regards,

Dan

--- array.orig  Fri Oct 27 09:16:31 2006
+++ array.c     Fri Oct 27 09:18:27 2006
@@ -3014,8 +3014,8 @@
     rb_define_method(rb_cArray, "sort!", rb_ary_sort_bang, 0);
     rb_define_method(rb_cArray, "collect", rb_ary_collect, 0);
     rb_define_method(rb_cArray, "collect!", rb_ary_collect_bang, 0);
-    rb_define_method(rb_cArray, "map", rb_ary_collect, 0);
-    rb_define_method(rb_cArray, "map!", rb_ary_collect_bang, 0);
+    rb_define_alias(rb_cArray, "map", "collect");
+    rb_define_alias(rb_cArray, "map!", "collect!");
     rb_define_method(rb_cArray, "select", rb_ary_select, 0);
     rb_define_method(rb_cArray, "values_at", rb_ary_values_at, -1);
     rb_define_method(rb_cArray, "delete", rb_ary_delete, 1);

------art_30117_83459.1161965517484
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi all,<br><br>This isn't nearly as sexy or glamorous as the String &lt;t; Symbol discussion, but hey, sometimes it's the little things. ;)<br><br>At the moment, the Array#map and Array#map! methods aren't officially defined as aliases.&nbsp; This seemingly trivial issue has one current problem and could potentially lead to issues in the future.
<br><br>The current (minor) problem is that rdoc doesn't properly document them as aliases.<br><br>The potential problem for the future relates to an idea I had back at ruby-talk:196740.&nbsp; If ever we decide to add an Object.aliased_methods
 method (or whatever we call it), these methods would not show up.&nbsp; Then imagine a scenario where, after implementing Object.aliases_methods, someone implements a hack so that redefined methods also redefined the aliases, say through method_added.
<br><br>BTW, I would have also changed Array#indexes and Array#indices, but they appear to have some extra warning code, so aren't true aliases.<br><br>Regards,<br><br>Dan<br><br>--- array.orig&nbsp; Fri Oct 27 09:16:31 2006<br>
+++ array.c&nbsp;&nbsp;&nbsp;&nbsp; Fri Oct 27 09:18:27 2006<br>@@ -3014,8 +3014,8 @@<br>&nbsp;&nbsp;&nbsp;&nbsp; rb_define_method(rb_cArray, &quot;sort!&quot;, rb_ary_sort_bang, 0);<br>&nbsp;&nbsp;&nbsp;&nbsp; rb_define_method(rb_cArray, &quot;collect&quot;, rb_ary_collect, 0);<br>
&nbsp;&nbsp;&nbsp;&nbsp; rb_define_method(rb_cArray, &quot;collect!&quot;, rb_ary_collect_bang, 0);<br>-&nbsp;&nbsp;&nbsp; rb_define_method(rb_cArray, &quot;map&quot;, rb_ary_collect, 0);<br>-&nbsp;&nbsp;&nbsp; rb_define_method(rb_cArray, &quot;map!&quot;, rb_ary_collect_bang, 0);
<br>+&nbsp;&nbsp;&nbsp; rb_define_alias(rb_cArray, &quot;map&quot;, &quot;collect&quot;);<br>+&nbsp;&nbsp;&nbsp; rb_define_alias(rb_cArray, &quot;map!&quot;, &quot;collect!&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp; rb_define_method(rb_cArray, &quot;select&quot;, rb_ary_select, 0);
<br>&nbsp;&nbsp;&nbsp;&nbsp; rb_define_method(rb_cArray, &quot;values_at&quot;, rb_ary_values_at, -1);<br>&nbsp;&nbsp;&nbsp;&nbsp; rb_define_method(rb_cArray, &quot;delete&quot;, rb_ary_delete, 1);

------art_30117_83459.1161965517484--