[ruby-core:88365] [Ruby trunk Feature#14887] Array#delete_if does not use #delete

From: matz@...
Date: 2018-08-09 06:13:41 UTC
List: ruby-core #88365
Issue #14887 has been updated by matz (Yukihiro Matsumoto).


It is intentional optimization for time & space. Besides that a subclass of Array (or String) is generally not a good idea.

Matz.


----------------------------------------
Feature #14887: Array#delete_if does not use #delete
https://bugs.ruby-lang.org/issues/14887#change-73403

* Author: sdaubert (Sylvain Daubert)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
When a class inherits from Array, and its #delete methods is modified, #delete_if and #reject! do not call this method. From sources, its an internal C method which is called instead.

Is there a way to modify #delete_if and #reject! to use #delete? This would ease inheriting of Array class.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next