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 On Wed, Jan 12, 2011 at 10:29 AM, Stuart Lodge <m...@slodge.com> wrote: > 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 > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core@rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > -- Jonathan Allen 619-933-8527
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core