[Ironruby-core] Overriding CLS Virtuals
Jim Deville
jdeville at microsoft.com
Tue Sep 9 19:45:28 EDT 2008
What if you do follow naming? Does def sayMultipleThings work?
JD
-----Original Message-----
From: Orion Edwards <orion.edwards at open2view.com>
Sent: September 09, 2008 2:28 PM
To: ironruby-core at rubyforge.org <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.03010407.07090506 at open2view.com]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080909/b8b6b5d4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.jpg
Type: image/jpeg
Size: 8147 bytes
Desc: signature.jpg
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080909/b8b6b5d4/attachment-0001.jpg>
More information about the Ironruby-core
mailing list