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
require ''mscorlib''
class Disposable
include System.IDisposable
def Dispose
# Do something
end
end
You can also override virtual properties. A class or interface that has the C#
declaration "string Value { get; set; }" is overridden from IronRuby
with methods named "Value" for the getter and "Value=" for
the setter.
Note that you need to use the same casing as the CLS definition for both methods
and properties.
We''re just getting started with better .NET interop support and
don''t have very much test coverage yet - but this should let you get
going on some more sophisticated interop scenarios than were previously
possible.
--
Curt Hagenlocher
curth at microsoft.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20080908/24d59288/attachment.html>
Oops... that should have said "include System::IDisposable". My
Outlook-based syntax checker is clearly not working.
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at
rubyforge.org] On Behalf Of Curt Hagenlocher
Sent: Monday, September 08, 2008 9:22 PM
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] Overriding CLS Virtuals
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
require ''mscorlib''
class Disposable
include System.IDisposable
def Dispose
# Do something
end
end
You can also override virtual properties. A class or interface that has the C#
declaration "string Value { get; set; }" is overridden from IronRuby
with methods named "Value" for the getter and "Value=" for
the setter.
Note that you need to use the same casing as the CLS definition for both methods
and properties.
We''re just getting started with better .NET interop support and
don''t have very much test coverage yet - but this should let you get
going on some more sophisticated interop scenarios than were previously
possible.
--
Curt Hagenlocher
curth at microsoft.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20080908/8ab4ae92/attachment.html>
An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080909/3ce168be/attachment-0001.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.jpg Type: image/jpeg Size: 8147 bytes Desc: not available URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080909/3ce168be/attachment-0001.jpg>
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>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 > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080908/dde34a36/attachment.html>
I don''t seem to be able to call Dispose on a filestream. Needless to
say this is problematic.
Here''s a paste, straight from the IR console (latest svn version 141)
>>> require ''mscorlib''
=> true
>>> include System::IO
=> Object
>>> $fs = FileStream.new( ''file.txt'',
FileMode.Open )
=> #
>>> $fs.Dispose
c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\matchcaller.generated.cs:30:in
`Call2'': wrong number or type of arguments for `Dispose''
(ArgumentError)
from
c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\callsite.cs:275:in
`UpdateAndExecute''
from
c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\updatedelegates.generated.cs:38:in
`Update2''
from :0
>>>
All the other methods on the filestream object work fine
(read_all_text, and so on), but the call to dispose crashes.
Likewise, I get a crash calling methods with overloads, which looks
like it may (??) be related.
>>> require ''mscorlib''
=> true
>>> include System::IO
=> Object
>>> $bytes = System::IO::File.read_all_bytes(
''file.txt'' ); nil # nil is to prevent ir from printing the
GIANT ARRAY
=> nil
>>> $text = System::Text::Encoding.UTF8.get_string($bytes)
c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\matchcaller.generated.cs:35:in
`Call3'': wrong number or type of arguments for `get_string''
(ArgumentError)
from
c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\callsite.cs:275:in
`UpdateAndExecute''
from
c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\updatedelegates.generated.cs:45:in
`Update3''
from :0
>>> $text = System::Text::Encoding.UTF8.get_string($bytes,
0, $bytes.length)
=> "PROPER TEXT GOES HERE"
It seems like it can''t figure out that there is GetString(bytes) and
GetString(bytes, index, length) and just uses the latter always.
Is there a solution for either of these problems?
Thanks a lot, Orion
Follow-up
If I call $fs.dispose(true), then it works.
It seems there''s a protected dispose(bool) in a derived class.
I can''t actually call Dispose(true) from C# as the compiler tells me
it''s protected.
It strikes me as somewhat broken that the method which ironruby
actually invokes is the one that you shouldn''t invoke...
At any rate, I''d be overjoyed if anyone could point me in the direction
of a fix. I''m trying to write ''using'' (a la C#) in
ruby as part of demo
for my local .NET user group. It should be trivial and showcase how
awesome IronRuby is :-(
Orion Edwards wrote:
I don''t seem to be able to call Dispose on a filestream. Needless to
say this is problematic.
Here''s a paste, straight from the IR console (latest svn version 141)
>>> require ''mscorlib''
=> true
>>> include System::IO
=> Object
>>> $fs = FileStream.new( ''file.txt'',
FileMode.Open )
=> #
>>> $fs.Dispose
c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\matchcaller.generated.cs:30:in
`Call2'': wrong number or type of arguments for `Dispose''
(ArgumentError)
from
c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\callsite.cs:275:in
`UpdateAndExecute''
from
c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\updatedelegates.generated.cs:38:in
`Update2''
from :0
>>>
All the other methods on the filestream object work fine
(read_all_text, and so on), but the call to dispose crashes.
Likewise, I get a crash calling methods with overloads, which looks
like it may (??) be related.
>>> require ''mscorlib''
=> true
>>> include System::IO
=> Object
>>> $bytes = System::IO::File.read_all_bytes(
''file.txt'' ); nil # nil is to prevent ir from printing the
GIANT ARRAY
=> nil
>>> $text = System::Text::Encoding.UTF8.get_string($bytes)
c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\matchcaller.generated.cs:35:in
`Call3'': wrong number or type of arguments for `get_string''
(ArgumentError)
from
c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\callsite.cs:275:in
`UpdateAndExecute''
from
c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\updatedelegates.generated.cs:45:in
`Update3''
from :0
>>> $text = System::Text::Encoding.UTF8.get_string($bytes,
0, $bytes.length)
=> "PROPER TEXT GOES HERE"
It seems like it can''t figure out that there is GetString(bytes) and
GetString(bytes, index, length) and just uses the latter always.
Is there a solution for either of these problems?
Thanks a lot, Orion
_______________________________________________
Ironruby-core mailing list
Ironruby-core-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/ironruby-core
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 [ironruby-core-bounces at rubyforge.org] On Behalf Of Brad Wilson [dotnetguy at gmail.com] Sent: Monday, September 08, 2008 9:39 PM To: 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>> 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
Curt Hagenlocher
2008-Sep-09 11:25 UTC
[Ironruby-core] Mysteriously broken calls to dispose?
Yes, this has been reported before (in fact, I think it was when someone was writing "using" ?) and we haven''t yet worked out a resolution. I''ll see if there''s something quick that can be fixed here later today. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Orion Edwards Sent: Monday, September 08, 2008 10:12 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Mysteriously broken calls to dispose? Follow-up If I call $fs.dispose(true), then it works. It seems there''s a protected dispose(bool) in a derived class. I can''t actually call Dispose(true) from C# as the compiler tells me it''s protected. It strikes me as somewhat broken that the method which ironruby actually invokes is the one that you shouldn''t invoke... At any rate, I''d be overjoyed if anyone could point me in the direction of a fix. I''m trying to write ''using'' (a la C#) in ruby as part of demo for my local .NET user group. It should be trivial and showcase how awesome IronRuby is :-( Orion Edwards wrote: I don''t seem to be able to call Dispose on a filestream. Needless to say this is problematic. Here''s a paste, straight from the IR console (latest svn version 141)>>> require ''mscorlib''=> true>>> include System::IO=> Object>>> $fs = FileStream.new( ''file.txt'', FileMode.Open )=> #<System::IO::FileStream:0x000005c>>>> $fs.Disposec:\development\ironruby\trunk\src\microsoft.scripting.core\actions\matchcaller.generated.cs:30:in `Call2'': wrong number or type of arguments for `Dispose'' (ArgumentError) from c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\callsite.cs:275:in `UpdateAndExecute'' from c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\updatedelegates.generated.cs:38:in `Update2'' from :0>>>All the other methods on the filestream object work fine (read_all_text, and so on), but the call to dispose crashes. Likewise, I get a crash calling methods with overloads, which looks like it may (??) be related.>>> require ''mscorlib''=> true>>> include System::IO=> Object>>> $bytes = System::IO::File.read_all_bytes( ''file.txt'' ); nil # nil is to prevent ir from printing the GIANT ARRAY=> nil>>> $text = System::Text::Encoding.UTF8.get_string($bytes)c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\matchcaller.generated.cs:35:in `Call3'': wrong number or type of arguments for `get_string'' (ArgumentError) from c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\callsite.cs:275:in `UpdateAndExecute'' from c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\updatedelegates.generated.cs:45:in `Update3'' from :0>>> $text = System::Text::Encoding.UTF8.get_string($bytes, 0, $bytes.length)=> "PROPER TEXT GOES HERE" It seems like it can''t figure out that there is GetString(bytes) and GetString(bytes, index, length) and just uses the latter always. Is there a solution for either of these problems? Thanks a lot, Orion ________________________________ _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080909/75f3043a/attachment-0001.html>
Ivan Porto Carrero
2008-Sep-09 11:34 UTC
[Ironruby-core] Mysteriously broken calls to dispose?
yep that is correct :) http://github.com/casualjim/ironnails/tree/master/IronNails/vendor/iron_nails/lib/core_ext/kernel.rb I figure you can wrap that in a begin..rescue block again and first try the one with the bool and then the one without it. Some implementations of Dispose don''t actually implement the method with a bool as parameter. Instead of FileStream you can use the ruby File class or you could write a FileStreamAdapter in C# or something so you can safely use it from IronRuby without the overloading mayhem. Cheers Ivan On Tue, Sep 9, 2008 at 1:25 PM, Curt Hagenlocher <curth at microsoft.com>wrote:> Yes, this has been reported before (in fact, I think it was when someone > was writing "using" J) and we haven''t yet worked out a resolution. I''ll > see if there''s something quick that can be fixed here later today. > > > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Orion Edwards > *Sent:* Monday, September 08, 2008 10:12 PM > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] Mysteriously broken calls to dispose? > > > > Follow-up > > If I call $fs.dispose(true), then it works. > > It seems there''s a protected dispose(bool) in a derived class. > I can''t actually call Dispose(true) from C# as the compiler tells me it''s > protected. > > It strikes me as somewhat broken that the method which ironruby actually > invokes is the one that you shouldn''t invoke... > > At any rate, I''d be overjoyed if anyone could point me in the direction of > a fix. I''m trying to write ''using'' (a la C#) in ruby as part of demo for my > local .NET user group. It should be trivial and showcase how awesome > IronRuby is :-( > > Orion Edwards wrote: > > I don''t seem to be able to call Dispose on a filestream. Needless to say > this is problematic. > > Here''s a paste, straight from the IR console (latest svn version 141) > > >>> require ''mscorlib'' > > => true > > >>> include System::IO > > => Object > > >>> $fs = FileStream.new( ''file.txt'', FileMode.Open ) > > => #<System::IO::FileStream:0x000005c> > > >>> $fs.Dispose > > c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\matchcaller.generated.cs:30:in `Call2'': wrong number or type of arguments for `Dispose'' (ArgumentError) > > from c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\callsite.cs:275:in `UpdateAndExecute'' > > from c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\updatedelegates.generated.cs:38:in `Update2'' > > from :0 > > >>> > > > > > > All the other methods on the filestream object work fine (read_all_text, > and so on), but the call to dispose crashes. > > Likewise, I get a crash calling methods with overloads, which looks like it > may (??) be related. > > >>> require ''mscorlib'' > > => true > > >>> include System::IO > > => Object > > >>> $bytes = System::IO::File.read_all_bytes( ''file.txt'' ); nil # nil is to prevent ir from printing the GIANT ARRAY > > => nil > > >>> $text = System::Text::Encoding.UTF8.get_string($bytes) > > c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\matchcaller.generated.cs:35:in `Call3'': wrong number or type of arguments for `get_string'' (ArgumentError) > > from c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\callsite.cs:275:in `UpdateAndExecute'' > > from c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\updatedelegates.generated.cs:45:in `Update3'' > > from :0 > > > > >>> $text = System::Text::Encoding.UTF8.get_string($bytes, 0, $bytes.length) > > => "PROPER TEXT GOES HERE" > > > > It seems like it can''t figure out that there is GetString(bytes) and > GetString(bytes, index, length) and just uses the latter always. > Is there a solution for either of these problems? > > Thanks a lot, Orion > > > > > > ------------------------------ > > > > _______________________________________________ > > Ironruby-core mailing list > > Ironruby-core at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080909/a0872d90/attachment.html>
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] On Behalf Of Jim Deville Sent: Tuesday, September 09, 2008 1:01 AM To: 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 [ironruby-core-bounces at rubyforge.org] On Behalf Of Brad Wilson [dotnetguy at gmail.com] Sent: Monday, September 08, 2008 9:39 PM To: 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>> 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 http://rubyforge.org/mailman/listinfo/ironruby-core
Curt Hagenlocher
2008-Sep-09 12:00 UTC
[Ironruby-core] Mysteriously broken calls to dispose?
Well, the interface itself only contains the parameterless method. The version with the parameter is part of a very common pattern that also optimizes the finalization experience and plays nicely with derived classes. If you''re really concerned about cleaning something up, you''ll probably follow that pattern. But if you''re just interested in the syntactic sugar of "using" and/or never expect the object''s lifespan to exceed that of the current method, then there''s no real need to implement the additional two methods or pay the cost of having a finalizer. (Even if you suppress it later, creating an object with a finalizer is more expensive than creating it without one iirc.) IDisposable is one of my favorite topics. I believe that officially makes me a masochist. From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero Sent: Tuesday, September 09, 2008 4:34 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Mysteriously broken calls to dispose? yep that is correct :) http://github.com/casualjim/ironnails/tree/master/IronNails/vendor/iron_nails/lib/core_ext/kernel.rb I figure you can wrap that in a begin..rescue block again and first try the one with the bool and then the one without it. Some implementations of Dispose don''t actually implement the method with a bool as parameter. Instead of FileStream you can use the ruby File class or you could write a FileStreamAdapter in C# or something so you can safely use it from IronRuby without the overloading mayhem. Cheers Ivan On Tue, Sep 9, 2008 at 1:25 PM, Curt Hagenlocher <curth at microsoft.com<mailto:curth at microsoft.com>> wrote: Yes, this has been reported before (in fact, I think it was when someone was writing "using" ?) and we haven''t yet worked out a resolution. I''ll see if there''s something quick that can be fixed here later today. From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org>] On Behalf Of Orion Edwards Sent: Monday, September 08, 2008 10:12 PM To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org> Subject: Re: [Ironruby-core] Mysteriously broken calls to dispose? Follow-up If I call $fs.dispose(true), then it works. It seems there''s a protected dispose(bool) in a derived class. I can''t actually call Dispose(true) from C# as the compiler tells me it''s protected. It strikes me as somewhat broken that the method which ironruby actually invokes is the one that you shouldn''t invoke... At any rate, I''d be overjoyed if anyone could point me in the direction of a fix. I''m trying to write ''using'' (a la C#) in ruby as part of demo for my local .NET user group. It should be trivial and showcase how awesome IronRuby is :-( Orion Edwards wrote: I don''t seem to be able to call Dispose on a filestream. Needless to say this is problematic. Here''s a paste, straight from the IR console (latest svn version 141)>>> require ''mscorlib''=> true>>> include System::IO=> Object>>> $fs = FileStream.new( ''file.txt'', FileMode.Open )=> #<System::IO::FileStream:0x000005c>>>> $fs.Disposec:\development\ironruby\trunk\src\microsoft.scripting.core\actions\matchcaller.generated.cs:30:in `Call2'': wrong number or type of arguments for `Dispose'' (ArgumentError) from c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\callsite.cs:275:in `UpdateAndExecute'' from c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\updatedelegates.generated.cs:38:in `Update2'' from :0>>>All the other methods on the filestream object work fine (read_all_text, and so on), but the call to dispose crashes. Likewise, I get a crash calling methods with overloads, which looks like it may (??) be related.>>> require ''mscorlib''=> true>>> include System::IO=> Object>>> $bytes = System::IO::File.read_all_bytes( ''file.txt'' ); nil # nil is to prevent ir from printing the GIANT ARRAY=> nil>>> $text = System::Text::Encoding.UTF8.get_string($bytes)c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\matchcaller.generated.cs:35:in `Call3'': wrong number or type of arguments for `get_string'' (ArgumentError) from c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\callsite.cs:275:in `UpdateAndExecute'' from c:\development\ironruby\trunk\src\microsoft.scripting.core\actions\updatedelegates.generated.cs:45:in `Update3'' from :0>>> $text = System::Text::Encoding.UTF8.get_string($bytes, 0, $bytes.length)=> "PROPER TEXT GOES HERE" It seems like it can''t figure out that there is GetString(bytes) and GetString(bytes, index, length) and just uses the latter always. Is there a solution for either of these problems? Thanks a lot, Orion ________________________________ _______________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080909/32f53b98/attachment-0001.html>
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] On Behalf Of Curt Hagenlocher Sent: Tuesday, September 09, 2008 4:40 AM To: 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] On Behalf Of Jim Deville Sent: Tuesday, September 09, 2008 1:01 AM To: 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 [ironruby-core-bounces at rubyforge.org] On Behalf Of Brad Wilson [dotnetguy at gmail.com] Sent: Monday, September 08, 2008 9:39 PM To: 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>> 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 http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
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> Sent: September 09, 2008 8:55 AM To: ironruby-core at rubyforge.org <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] On Behalf Of Curt Hagenlocher Sent: Tuesday, September 09, 2008 4:40 AM To: 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] On Behalf Of Jim Deville Sent: Tuesday, September 09, 2008 1:01 AM To: 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 [ironruby-core-bounces at rubyforge.org] On Behalf Of Brad Wilson [dotnetguy at gmail.com] Sent: Monday, September 08, 2008 9:39 PM To: 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>> 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 http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
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] On Behalf Of Jim Deville Sent: Tuesday, September 09, 2008 9:43 AM To: 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> Sent: September 09, 2008 8:55 AM To: ironruby-core at rubyforge.org <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] On Behalf Of Curt Hagenlocher Sent: Tuesday, September 09, 2008 4:40 AM To: 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] On Behalf Of Jim Deville Sent: Tuesday, September 09, 2008 1:01 AM To: 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 [ironruby-core-bounces at rubyforge.org] On Behalf Of Brad Wilson [dotnetguy at gmail.com] Sent: Monday, September 08, 2008 9:39 PM To: 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>> 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 http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
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> Sent: September 09, 2008 9:44 AM To: ironruby-core at rubyforge.org <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] On Behalf Of Jim Deville Sent: Tuesday, September 09, 2008 9:43 AM To: 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> Sent: September 09, 2008 8:55 AM To: ironruby-core at rubyforge.org <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] On Behalf Of Curt Hagenlocher Sent: Tuesday, September 09, 2008 4:40 AM To: 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] On Behalf Of Jim Deville Sent: Tuesday, September 09, 2008 1:01 AM To: 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 [ironruby-core-bounces at rubyforge.org] On Behalf Of Brad Wilson [dotnetguy at gmail.com] Sent: Monday, September 08, 2008 9:39 PM To: 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>> 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 http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080910/15655d59/attachment-0001.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.jpg Type: image/jpeg Size: 8147 bytes Desc: not available URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080910/15655d59/attachment-0001.jpg>
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>
An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080910/c11c03b3/attachment-0001.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 8147 bytes Desc: not available URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080910/c11c03b3/attachment-0001.jpe> -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.jpg Type: image/jpeg Size: 8147 bytes Desc: not available URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080910/c11c03b3/attachment-0001.jpg>
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]
Are we going to have "real" properties under the hood, because what we have for now is just method with "get_PropertyName"? And this did not play nicely with databinding. I think the same question applies for events as well. 2008/9/9 Curt Hagenlocher <curth at microsoft.com>> 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 > > > > require ''mscorlib'' > > class Disposable > > include System.IDisposable > > def Dispose > > # Do something > > end > > end > > > > You can also override virtual properties. A class or interface that has > the C# declaration "string Value { get; set; }" is overridden from IronRuby > with methods named "Value" for the getter and "Value=" for the setter. > > > > Note that you need to use the same casing as the CLS definition for both > methods and properties. > > > > We''re just getting started with better .NET interop support and don''t have > very much test coverage yet ? but this should let you get going on some more > sophisticated interop scenarios than were previously possible. > > > > -- > > Curt Hagenlocher > > curth at microsoft.com > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080911/558af10d/attachment.html>
Right now, the only way to get properties is to implement an interface that
defines them. When IronRuby supports this "natively", it will have to
define a syntax for doing so. That''s because the Ruby language
supports neither properties, attributes nor static types - all of which will be
needed. This will probably involve adding some new methods to Class that allow
you to define typed CLS members. But we don''t have a specific
timeframe for implementing this yet.
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at
rubyforge.org] On Behalf Of Stefan Dobrev
Sent: Wednesday, September 10, 2008 2:46 PM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Overriding CLS Virtuals
Are we going to have "real" properties under the hood, because what we
have for now is just method with "get_PropertyName"? And this did not
play nicely with databinding.
I think the same question applies for events as well.
2008/9/9 Curt Hagenlocher <curth at microsoft.com<mailto:curth at
microsoft.com>>
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
require ''mscorlib''
class Disposable
include System.IDisposable
def Dispose
# Do something
end
end
You can also override virtual properties. A class or interface that has the C#
declaration "string Value { get; set; }" is overridden from IronRuby
with methods named "Value" for the getter and "Value=" for
the setter.
Note that you need to use the same casing as the CLS definition for both methods
and properties.
We''re just getting started with better .NET interop support and
don''t have very much test coverage yet - but this should let you get
going on some more sophisticated interop scenarios than were previously
possible.
--
Curt Hagenlocher
curth at microsoft.com<mailto:curth at microsoft.com>
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20080916/d02240fa/attachment.html>