[Ironruby-core] Friday Status Update
Tomas.Matousek at microsoft.com
Sat May 3 11:51:46 EDT 2008
Yes, we have Protocols class that implements various flavors of conversions that are used in libraries.
The binder idea is that there would be an attribute you can apply on C# methods that would disable the default conversions implemented in binder. So if 90% of methods do the conversion one way their implementation could be simplified. The rest would be marked by the attribute.
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Charles Oliver Nutter
Sent: Saturday, May 03, 2008 1:05 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Friday Status Update
Peter Bacon Darwin wrote:
> I might be right off track here and since I haven't seen any of the detailed
> discussion about the question below I might be being completely naive.
> The open question should really be targeting all standard conversion
> protocols in Ruby.
> In my mind it seems that the way Ruby works generally is to have a load of
> these "protocols" for type conversion, but that it is not enforced by the
> language at all and that it is entirely up the library developer to follow
> suit. While this allows ultimate freedom for the developer it obviously
> does allow inconsistency to creep in.
> I would feel uncomfortable baking these protocols into the binder, unless
> there was some way of overriding them in library code, since this is
> perfectly possible in MRI. For instance, it must be possible in at least
> some cases to monkey patch code that by default uses the standard conversion
> protocol so that it does something different (e.g. converts strings to
> symbols in some other way???)
> Clearly this is not a good thing to do in general but since Ruby allows it
> as a language, it seems that it should be supported in IronRuby.
FYI, there are a few cases in the core classes that use e.g to_s or to_a
instead of to_str or to_ary to coerce. I don't remember them off the top
of my head.
Ironruby-core mailing list
Ironruby-core at rubyforge.org
More information about the Ironruby-core