Actions
Bug #11063
closedSpecial singleton class should return true for singleton_class? test
    Bug #11063:
    Special singleton class should return true for singleton_class? test
  
Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
Tags:
Description
This seems wrong (or at least inconsistent):
nil.singleton_class.singleton_class? #=> false
true.singleton_class.singleton_class? #=> false
false.singleton_class.singleton_class? #=> false
Files
        
           Updated by Eregon (Benoit Daloze) over 3 years ago
          Updated by Eregon (Benoit Daloze) over 3 years ago
          
          
        
        
      
      - Related to Bug #11064: #singleton_methods for objects with special singleton_class returns an empty array added
        
           Updated by Eregon (Benoit Daloze) over 3 years ago
          Updated by Eregon (Benoit Daloze) over 3 years ago
          
          
        
        
      
      - Related to Feature #12084: `Class#instance` added
        
           Updated by Eregon (Benoit Daloze) over 3 years ago
          Updated by Eregon (Benoit Daloze) over 3 years ago
          
          
        
        
      
      Changing this would cause the reverse inconsistency:
false.class.singleton_class? #=> would be true, but .class.singleton_class? should always be false
The only real fix would be to have separate class and singleton_class for nil/false/true, but it's unclear if that's worth it.
        
           Updated by matz (Yukihiro Matsumoto) over 3 years ago
          Updated by matz (Yukihiro Matsumoto) over 3 years ago
          
          
        
        
      
      - Status changed from Open to Rejected
This inconsistency does not have any actual drawback, so we keep the current behavior.
Matz.
Actions