[Ironruby-core] Why does attr_accessor create a property, but method is just a method?
Jörg W Mittag
JoergWMittag+Ruby at GoogleMail.Com
Fri Jul 23 11:13:36 EDT 2010
Brian Genisio wrote:
> Thinking on this further, if there were some sort of interop-specific class
> method... like attr_clr_property :foo, that caused any methods named foo and
> foo=(var) to be visible to .Net as properties, that would be sufficient.
>
> Any thoughts on this?
Good idea. Would it make sense to coordinate with other
implementations to get some more generic name and semantics?
Objective-C (and thus MacRuby) also has a notion of properties, right?
As do JavaBeans.
What about
Module#prop_accessor
Module#prop_getter
Module#prop_setter
That way, if I have a simple PORO/POCO/POJO that I want to be able to
interoperate with platform-native code, I only need to switch out
require 'clr' for require 'java', but not change any of my other code.
(Assuming, of course, that the only .NET-specific stuff in my code are
properties.)
jwm
More information about the Ironruby-core
mailing list