Forum: IronRuby Code Review: GenericMethodsAndOverloads

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-01-13 00:04
(Received via mailing list)
Attachment: GenericMethodsAndOverloads.diff (40 KB)
tfpt review "/shelveset:GenericMethodsAndOverloads;REDMOND\tomat"

    Implements generic methods parameters binding and explicit overload
selection. Adds methods Method/UnboundMethod#of and
Method/UnboundMethod#overloads. Method#of takes a list of Ruby classes
or CLR types and returns a Method instance that has bound generic
parameters to these classes/types. Method#overloads takes a list of Ruby
classes or CLR types and returns a Method instance that includes only
those CLR methods grouped in the Method object whose parameters are of
the given types.

Tomas
F983f0c990cba2fe743ef62a975ec99c?d=identicon&s=25 Curt Hagenlocher (Guest)
on 2009-01-14 05:49
(Received via mailing list)
Changes look good overall.

In RubyMethodGroupInfo.TryBindGenericParameters, an empty set of types
will return all methods in MethodBases whether or not they're generic.
What's the reason for this behavior?

There's a chunk of code that was added to Utils.cs that's indented too
far.
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-01-14 07:32
(Received via mailing list)
TryBindGenericParameters should look like:

            foreach (var method in MethodBases) {
                if (method.IsGenericMethodDefinition) {
                    if (typeArguments.Length ==
method.GetGenericArguments().Length) {
                        Debug.Assert(!(method is ConstructorInfo));
                        boundMethods.Add(((MethodInfo)method).MakeGenericMethod(typeArguments));
                    }
                } else if (typeArguments.Length == 0) {
                    boundMethods.Add(method);
                }
            }

Will include this fix in Indexers2 shelveset.

Tomas
This topic is locked and can not be replied to.