# Code Review: NewSingletons3

**URL:** <https://www.ruby-forum.com/t/code-review-newsingletons3/169693>\
**Category:** IronRuby\
**Created:** [June 7, 2009, 6:14am UTC](https://www.ruby-forum.com/t/code-review-newsingletons3/169693 "2009-06-07T06:14:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [June 7, 2009, 6:14am UTC](https://www.ruby-forum.com/t/code-review-newsingletons3/169693/1 "2009-06-07T06:14:51Z")

</div>

tfpt review “/shelveset:NewSingletons3;REDMOND\tomat”

Initial work to improve singletons.

- Improves reflection cache generator - it searches IronRuby.dll for  
all types marked by [ReflectionCache] attribute and generates ref-cache  
entries for all their methods and properties marked with [Emitted]  
attribute.
- Merges RubyModule.Subclass into RubyModule, i.e. RubyModule now  
implements IRubyObject.
- IRubyObjects now hold on their immediate class (not nominal class)  
and that reference might change once from a non-singleton to a singleton  
class.  
This change allows IRubyObject singletons (including modules and  
classes when used in static method calls) to have the same rules as  
non-singleton objects. The rule no longer needs to hold on such objects.
- Implements module freezing: methods, constants, instance and class  
variables, mixins cannot be modified on a frozen module. Besides, if an  
object is frozen its singleton class is (recursively) frozen as well.
- Fixes object freezing: instance variables cannot be modified on a  
frozen object (we allowed it).

Tomas

---

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [June 8, 2009, 5:59am UTC](https://www.ruby-forum.com/t/code-review-newsingletons3/169693/2 "2009-06-08T05:59:11Z")

</div>

Looks good.
