From: eregontp@...
Date: 2018-01-25T22:25:54+00:00
Subject: [ruby-core:85125] [Ruby trunk Feature#14394] Class.descendants

Issue #14394 has been updated by Eregon (Benoit Daloze).


I think one part of the discussion was that this features requires classes to explicitly track their subclasses (which is a memory overhead, and it must be a list of weak references to avoid leaking subclasses).
I think MRI now tracks subclasses but didn't use to.
FWIW TruffleRuby currently doesn't need to track subclasses (But doing it would probably not be a very big overhead, we already need to track constants, class vars and methods in each Class so Class objects are anyway not so lightweight).

----------------------------------------
Feature #14394: Class.descendants
https://bugs.ruby-lang.org/issues/14394#change-69839

* Author: ridiculous (Ryan Buckley)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
There have been numerous implementations of the method Class.descendants by various gems. However, I can't help but think that this ability should be included in the Ruby language itself. Especially since Ruby already offers the counterpart method Class.ancestors.

Would it possible to add a `descendants` class method?



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

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>