# Code Review: Operators4

**URL:** <https://www.ruby-forum.com/t/code-review-operators4/165410>\
**Category:** IronRuby\
**Created:** [April 13, 2009, 7:09pm UTC](https://www.ruby-forum.com/t/code-review-operators4/165410 "2009-04-13T19:09:26Z")\
**Posts on this page:** 1\
**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:** [April 13, 2009, 7:09pm UTC](https://www.ruby-forum.com/t/code-review-operators4/165410/1 "2009-04-13T19:09:26Z")

</div>

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

Outer DLR, Python:  
Factors MethodCandidate construction out to a separate class  
(ParameterMapping).  
Replaces OverloadResolver.BindSpecialParameter and  
PrepareParameterBinding with a single method MapSpecialParameters.  
Languages can override this method to process custom special parameters  
(CodeContext, site local storage, blocks, etc. …). The implementation  
works with ParameterMapping and adds arg-builders and parameter wrappers  
to the collections encapsulated in it. It returns a bitmap of parameters  
that indicate what parameters were processed. The mapping is then  
finished by constructing the remaining parameters.

Ruby:  
Adds support for .NET operators (op\_\* special methods). These methods  
behave like extension methods so some adjustments were needed in  
RubyOverloadResolver to handle “self” correctly.

Implements bitwise operators on flag enums: each flag enum gets a  
FlagEnumeration mixin that includes &, |, ^, and ~ methods. The  
implementation is the same as Python have so I factored it out to  
EnumUtils in DLR.

Fixes implementation of RubyObject.ToString and Kernel#to\_s so that  
“to\_s” is called from ToString on Ruby objects and ToString is called  
from Kernel#to\_s for .NET objects. Also implements ToString on built-ins  
where it was missing and it makes sense to have it: range and regex.  
Although Array and Hash implement to\_s as well the result is a plain  
concatenation of string representation of their items (entires). E.g.  
[“a b”, “c”].to\_s == “a bc”. I don’t think adding  
RubyArray/Hash.ToString doing the same would be useful for .NET users.

Moves Protocols from libraries to IronRuby.dll.

Tomas
