[Ironruby-core] Value types - e.g. TimeSpan
grauenwolf at gmail.com
Wed Jan 12 13:37:16 EST 2011
You could probably allow methods as well, as the vast majority of value
types are immutable. Even in C#, calling Set on a value type only works if
that value type happens to be a local variable. If it comes back from a
property then it just becomes a no-op.
On Wed, Jan 12, 2011 at 10:29 AM, Stuart Lodge <me at slodge.com> wrote:
> 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
> 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...
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironruby-core