Hi all I've had some discussions offline about accessing the properties of TimeSpan. 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... Stuart
on 2011-01-12 19:30
on 2011-01-12 20:14
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. Jonathan
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.