Code Review: Operators4

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

Outer DLR, Python:
Factors MethodCandidate construction out to a separate class
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.

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.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs