[Ironruby-core] Value types - e.g. TimeSpan

Stuart Lodge me at slodge.com
Wed Jan 12 13:29:41 EST 2011

Hi all

I've had some discussions offline about accessing the properties of

The issue is that while the static methods on TimeSpan work, the instance
properties don't:

t = System::TimeSpan.from_seconds(1.1) # works
m = t.total_milliseconds # doesn't work

All my testing done on iron7 on WP7 of course!

The route of this problem seems to be (from Tomas Matousek):

The problem is that the interpreter doesn't support instance method calls on
> value types:

> if (!node.Method.IsStatic && node.Method.DeclaringType.IsValueType &&
> !node.Method.DeclaringType.IsPrimitive)) _forceCompile = true;

> Such method can update the value type in-place, which is difficult to
> interpret. We don't know that the method is only reading the fields of the
> value type, so we disallow interpretation even if we could do that. I'll
> think about how to fix this but am not sure if we can do anything
> reasonable.

We're thinking about this... one thing is that I think we could allow this
for Get methods - for readonly properties - I need to read the code a bit (a
lot!) more before I can comment on whether this is correct though...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20110112/155a2c6d/attachment.html>

More information about the Ironruby-core mailing list