[Ironruby-core] Automagically tracking progress of library work

John Lam (DLR) jflam at microsoft.com
Fri Oct 5 20:05:22 EDT 2007

After talking it over with Tomas and John over lunch, we figured that it would be best if all we did was introduce a NotCompletedAttribute rather than create a code generator. The challenge is in deciding what the correct signatures for the methods should be, with an eye toward not confusing casual readers of the code.

For example, consider Array#last:

[RubyMethodAttribute("last", RubyMethodAttributes.PublicInstance)]
public static object Last(List<object>/*!*/ self) {
    return self.Count == 0 ? null : self[self.Count - 1];

[RubyMethodAttribute("last", RubyMethodAttributes.PublicInstance)]
public static object Last(List<object>/*!*/ self, int count) {
    if (count < 0)
        throw RubyExceptions.CreateArgumentError("negative array size (or size too big)");

    count = count > self.Count ? self.Count : count;
    return self.GetRange(self.Count - count, count);

[RubyMethodAttribute("last", RubyMethodAttributes.PublicInstance)]
public static object Last(CodeContext/*!*/ context, List<object>/*!*/ self, object count) {
    return Last(self, Protocols.CastToFixnum(context, count));

Note that there are multiple overloads of this method, and the variation in the argument types.

We can easily tell if a method is not implemented since the binder will not find it. We can reflect over the target method at runtime to look for the NotCompleted attribute, and issue a warning if you try to call a method that isn't complete as well.


More information about the Ironruby-core mailing list