[Ironruby-core] Fixnum Patch
jomes at microsoft.com
Wed Dec 12 16:07:39 EST 2007
Brian J. Cardiff wrote:
> I agree in the pros of using nullable: Clarity and Performance.
> Also my previous mail was inspired in what your original need: returns
> int or null, so using Nullable<int> it seems to be the smallest
> solution. But I didn't have in mind if there are some issues in
> exposing them to the ruby engine.
Definitely a good thing to do--as long as we actually handle Nullable<int> correctly. Off the top of my head I'm not sure. Worth trying though.
For better or worse, there are a lot of methods that need to have their return types typed to System.Object. Methods that take blocks usually need to return object (in case the block breaks with an arbitrary object, which we need to pass through). Also if you're calling back through a dynamic site into Ruby code, even if the method should normally return a particular type (for example, <=> is supposed to return Fixnum +1, 0, or -1), nothing stops the user from returning whatever they want. We actually don't get this right today in several places.
(Ah, the fun of implementing a dynamically typed language in a statically typed one :-) )
More information about the Ironruby-core