[Ironruby-core] Friday Status Update

Peter Bacon Darwin bacondarwin at googlemail.com
Sat May 3 03:44:52 EDT 2008


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.

Happy to be completely wrong here.

Pete

-----Original Message-----
From: ironruby-core-bounces at rubyforge.org
[mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of John Lam
(IRONRUBY)
Sent: Friday,02 May 02, 2008 23:25
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Friday Status Update

I'm still working on the shelveset that I sent out for code review earlier
today (bugfixes9). We found a few more issues when we did the code review.
The most interesting case is this one:

We normally define methods that accept symbol using a signature that takes a
SymbolId, eg:


[RubyMethod("attr", RubyMethodAttributes.PrivateInstance)]
public static void Attr(CodeContext/*!*/ context, RubyModule/*!*/ self,
SymbolId name) {
    DefineAccessor(context, self, name, true, false);
}


Methods like these will blow up if you pass it a 'string-like' thing. We
have a Protocol to convert these things - Protocols.CastToSymbol(), which
does the right thing, which is call to_str on the target.

We have an open question right now which is whether we should bake in object
to SymbolId conversions in the binder or whether we should handle them in a
case by case basis by defining an overload that accepts an Object, and
calling Protocols.CastToSymbol() on that object.

Once I get this shelveset past the troll, I'll work next on getting
socket.cs and the ironi regex library into the tree.

Thanks,
-John

From: ironruby-core-bounces at rubyforge.org
[mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jim Deville
Sent: Friday, May 02, 2008 2:37 PM
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] Friday Status Update

Like we talked about earlier, let's give an update on what we are working on

I'm working on hacking optparse to work so that we can update to the newest
Rubinius spec's. Then I'll be closing out a whole slew of bugs.

Jim Deville
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core



More information about the Ironruby-core mailing list