Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

define anonymous modules to be reachable

#3722

Class#reachable? is defined for all classes, but the predicate raises an error if the class is anonymous because it evals malformed Ruby.

The goal of reachable? seems to be to look for class objects that are not anonymous but whose constant is gone or stores another object.

So the behaviour with anonymous classes seems to be just a technical detail and it would be easier if that was checked by the predicate itself (currently client code calls name.blank? by hand before). Also documentation would be clearer because now we have to say that subclasses_of returns descendants except for anonymous or reachable ones. It would be better if we could document subclasses_of returns all reachable descendants.

The patch adds tests for reachable? (there were none before), and defines also anonymous?.

Reported by Xavier Noria · January 17th, 2010 @ 09:52 AM

State: wontfix
Milestone: none
Assigned to: Jeremy Kemper Jeremy Kemper
Importance: Low

Activity

  1. Xavier Noria
    Xavier Noria
    • Title changed from define anonyomous classes to be reachable to define anonymous classes to be reachable

    January 17th, 2010 @ 09:53 AM

  2. Xavier Noria
    Xavier Noria

    I messed up with subclasses_of, it returns descendants which are either anonymous or reachable. That is an error probably in favour of this patch haha.

    January 17th, 2010 @ 09:55 AM

  3. Xavier Noria
    Xavier Noria
    • Title changed from define anonymous classes to be reachable to define anonymous modules to be reachable

    January 17th, 2010 @ 07:35 PM

  4. Xavier Noria
    Xavier Noria

    Being anonymous or reachable makes sense for modules. I've prepared a second patch with the definitions moved to Module, and with proper file organization.

    January 17th, 2010 @ 07:38 PM

  5. Xavier Noria
  6. Jeremy Kemper
    Jeremy Kemper
    • State changed from new to wontfix

    January 29th, 2010 @ 05:25 PM