[Ironruby-core] Overriding CLS Virtuals

Jim Deville jdeville at microsoft.com
Wed Sep 10 00:36:02 EDT 2008


Orion: Thanks a ton for doing that.
All: With that info, I vote we support both ways. It may be something to bring up a different day though.

JD
________________________________________
From: ironruby-core-bounces at rubyforge.org [ironruby-core-bounces at rubyforge.org] On Behalf Of Orion Edwards [orion.edwards at open2view.com]
Sent: Tuesday, September 09, 2008 4:59 PM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Overriding CLS Virtuals

Yes, sayMultipleThings works.

SayMultipleThings doesn't though (makes sense I guess)

Jim Deville wrote:

What if you do follow naming? Does def sayMultipleThings work?

JD

-----Original Message-----
From: Orion Edwards <orion.edwards at open2view.com><mailto:orion.edwards at open2view.com>
Sent: September 09, 2008 2:28 PM
To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> <ironruby-core at rubyforge.org><mailto:ironruby-core at rubyforge.org>
Subject: Re: [Ironruby-core] Overriding CLS Virtuals



Ask, and ye shall recieve.
jruby 1.1.4 on JDK 1.6:

Java Code:

public interface ISayer {
        public void say(String foo);
        public void sayMultipleThings(String foo, String bar);
}

public class SayThings {
        public static void sayThings( ISayer sayer ) {
                sayer.say("Invoked from java");

                sayer.sayMultipleThings("Saying Multiple", "Things From Java");
        }
}



Ruby Code:

require 'java'

$CLASSPATH << '.'

class RubySayer
        include Java::ISayer

        def say(word)
                puts "FROM RUBY: #{word}"
        end

        def say_multiple_things(first, second)
                puts "FROM RUBY: #{first}, #{second}"
        end
end

rc = RubySayer.new

Java::SayThings.say_things( rc )



When Run:

FROM RUBY: Invoked from java
FROM RUBY: Saying Multiple, Things From Java


Aside: Every time I go near java, CLASSPATH and 'one-class-per-file' makes me want to go outside and hit something. IronRuby isn't even finished yet and already I'd much rather use it :-)

Jim Deville wrote:

I saw a presentation that (if I remember correctly) showed methods like doFoo becoming do_foo. So I think they mangle method names. I don't know if they do this for interface methods, which is closer to this problem.

JD

-----Original Message-----
From: Curt Hagenlocher <curth at microsoft.com><mailto:curth at microsoft.com>
Sent: September 09, 2008 9:44 AM
To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> <ironruby-core at rubyforge.org><mailto:ironruby-core at rubyforge.org>
Subject: Re: [Ironruby-core] Overriding CLS Virtuals


The Java convention is that method names start with lower-case characters, so I don't imagine that there's any special handling being performed.

-----Original Message-----
From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jim Deville
Sent: Tuesday, September 09, 2008 9:43 AM
To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>
Subject: Re: [Ironruby-core] Overriding CLS Virtuals

I know their naming convention is different, but lets see what JRuby does too.

JD


-----Original Message-----
From: Tomas Matousek <Tomas.Matousek at microsoft.com><mailto:Tomas.Matousek at microsoft.com>
Sent: September 09, 2008 8:55 AM
To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> <ironruby-core at rubyforge.org><mailto:ironruby-core at rubyforge.org>
Subject: Re: [Ironruby-core] Overriding CLS Virtuals


Let's revisit that later, I'm also not sure what the details were.

Tomas

-----Original Message-----
From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Curt Hagenlocher
Sent: Tuesday, September 09, 2008 4:40 AM
To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>
Subject: Re: [Ironruby-core] Overriding CLS Virtuals

When you override a virtual method you're pushing much more into CLR-world than when you're just calling some function on some method.  In the latter case, you shouldn't have to know that the function you're calling is actually defined outside of Ruby, while in the former, this is a fairly important piece of information.

In any event, I recall that both John and Tomas felt that we shouldn't -- but no longer remember all the details.

-----Original Message-----
From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jim Deville
Sent: Tuesday, September 09, 2008 1:01 AM
To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>
Subject: Re: [Ironruby-core] Overriding CLS Virtuals

Are we planning on supporting name mangling to give more Ruby-ish names? Like will we be able to do "def dispose" instead of "def Dispose"?

JD
________________________________________
From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org>] On Behalf Of Brad Wilson [dotnetguy at gmail.com<mailto:dotnetguy at gmail.com>]
Sent: Monday, September 08, 2008 9:39 PM
To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>
Subject: Re: [Ironruby-core] Overriding CLS Virtuals

It's not real unless you start singing "You are the wind beneath my wings". :)

On Mon, Sep 8, 2008 at 9:36 PM, Orion Edwards <orion.edwards at open2view.com<mailto:orion.edwards at open2view.com><mailto:orion.edwards at open2view.com><mailto:orion.edwards at open2view.com>> wrote:
You are my hero :-)

Curt Hagenlocher wrote:

I've committed some changes to IronRuby (in SVN revision 141) that let you implement CLS interfaces and override virtual methods on CLS base types.  Interfaces work like Ruby modules, so to make your class implement IDisposable you could say

_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core

_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core

_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core

_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core

_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core

_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core


--
Orion Edwards
Web Application Developer

T: +64 7 859 2120
F: +64 7 859 2320
E: orion.edwards at open2view.com <mailto:orion.edwards at open2view.com>

Open2view.com
The Real Estate Website

[cid:part1.06070906.03010006 at open2view.com]



________________________________

_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core


--
Orion Edwards
Web Application Developer

T: +64 7 859 2120
F: +64 7 859 2320
E: orion.edwards at open2view.com <mailto:orion.edwards at open2view.com>

Open2view.com
The Real Estate Website

[cid:part2.04010708.01030107 at open2view.com]


More information about the Ironruby-core mailing list