Re: [Ironruby-core] Overriding CLS Virtuals

2008-10-26 Thread Ted Milker
On Sun, Oct 26, 2008 at 12:20 AM, Curt Hagenlocher [EMAIL PROTECTED] wrote:

 However, virtual calls from a C# application back into IronRuby are a 
 different matter, due Ruby's dynamic nature.  Here there is both a 
 performance cost and a semantic cost for performing multiple lookups.  The 
 performance cost results from the fact that we have to check for two 
 different symbol names on every CLS call to this method before we can 
 identify that we need to delegate to the base class implementation.  (To be 
 fair, this, too could be cached, albeit with slightly greater difficulty.)  
 The semantic cost is based in the confusion resulting when methods with both 
 names are defined on the class.  Should we call method dispose or method 
 Dispose? or both?

This is a tough one, glad I do not have to make the call.  Pitfalls
and trouble every way I try to think of it and type a response. :)  My
gut tells me that capitalization matters, regardless of The Ruby Way,
when it comes to .NET.  If you want to write a new Dispose, def
Dispose.

 Finally, as you're probably aware by now, capitalization in Ruby is not 
 simply a matter of convention.  In many cases, the parser actually treats 
 identifiers which start with a capital letter differently than it does 
 identifiers that start lower case.  Now it turns out that method names are 
 one of the places where Ruby doesn't draw this distinction, but I'd guess 
 that many Ruby programmers look at any identifier starting with a capital 
 letter and think that's a constant.

But given the following:

def Foo
Bar
end

Foo()

what Ruby programmer would look at Foo and still think it is a
constant?  Of course, if I would have made it lowercase, the
parentheses would not be necessary.  My point is that the parentheses
tell the reader that it is not a constant, but a method.  Is there a
situation where Foo could appear legally, as defined above, without
parentheses and be confused for a constant?
___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-10-26 Thread Jim Deville
The parenthesis do give an important clue, and luckily they are required for 
calling a method with a constant identifier. As far as idioms and conventions 
go, I don't know how much of an official convention (as much as a Ruby 
convention is official) there is, but the few cases of capitalized methods I've 
seen do one of two things, cast to the name of the method (Kernel.Float for 
example) or they return a class. An example of the second is the R() method in 
_why's Camping framework, which returns a class for controllers. It's used in 
class definitions in this case:

class Foo  R('/')
end

is a controller at the route / (root of the website). So since I'm used to 
that, I prefer seeing IDisposable use def dispose in my Ruby classes.

JD

From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Ted Milker [EMAIL 
PROTECTED]
Sent: Saturday, October 25, 2008 11:12 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Overriding CLS Virtuals

On Sun, Oct 26, 2008 at 12:20 AM, Curt Hagenlocher [EMAIL PROTECTED] wrote:

 However, virtual calls from a C# application back into IronRuby are a 
 different matter, due Ruby's dynamic nature.  Here there is both a 
 performance cost and a semantic cost for performing multiple lookups.  The 
 performance cost results from the fact that we have to check for two 
 different symbol names on every CLS call to this method before we can 
 identify that we need to delegate to the base class implementation.  (To be 
 fair, this, too could be cached, albeit with slightly greater difficulty.)  
 The semantic cost is based in the confusion resulting when methods with both 
 names are defined on the class.  Should we call method dispose or method 
 Dispose? or both?

This is a tough one, glad I do not have to make the call.  Pitfalls
and trouble every way I try to think of it and type a response. :)  My
gut tells me that capitalization matters, regardless of The Ruby Way,
when it comes to .NET.  If you want to write a new Dispose, def
Dispose.

 Finally, as you're probably aware by now, capitalization in Ruby is not 
 simply a matter of convention.  In many cases, the parser actually treats 
 identifiers which start with a capital letter differently than it does 
 identifiers that start lower case.  Now it turns out that method names are 
 one of the places where Ruby doesn't draw this distinction, but I'd guess 
 that many Ruby programmers look at any identifier starting with a capital 
 letter and think that's a constant.

But given the following:

def Foo
Bar
end

Foo()

what Ruby programmer would look at Foo and still think it is a
constant?  Of course, if I would have made it lowercase, the
parentheses would not be necessary.  My point is that the parentheses
tell the reader that it is not a constant, but a method.  Is there a
situation where Foo could appear legally, as defined above, without
parentheses and be confused for a constant?
___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-10-26 Thread Jay McGaffigan
With respect to conventions the dynamic languages are the first languages
that I've used that can actually depend on the casing (and pluralization) to
work right (think active record models).  Now it's no longer part of the
readability factor of code but it can play an important part in how a DSL
works.

Jay

On Sat, Oct 25, 2008 at 7:59 PM, Orion Edwards
[EMAIL PROTECTED]wrote:

 I used to think this kind of thing too.

 Each language (or large-subset-of-language) has it's own conventions.

 Examples:

 gnu/posix C:  lower_underscore_case
 Microsoft C (eg the win32 api): UpperCamelCase
 Java: lowerCamelCase
 Javascript: lowerCamelCase
 .NET: UpperCamelCase (except local variables which seem to be
 lowerCamelCase)
 ruby/python: lower_underscore_case

 While none of the languages will stop you from using any conventions you
 like, it's MUCH easier to learn to put your ego aside, and go with the
 conventions.

 The simple fact is, you're going to be reading loads of sourcecode written
 by others in the form of examples and so forth, and if you get annoyed every
 time you see stuff you 'hate' - well you're going to be having a pretty
 unhappy time.


 On 25/10/2008, at 2:11 PM, Ted Milker wrote:

 On Fri, Oct 24, 2008 at 7:54 PM, Curt Hagenlocher [EMAIL PROTECTED]
 wrote:

 We're thinking now that we're going to go with the mangled version of the
 name instead of the originally cased-version.  Dispose just doesn't
 look
 Rubyish enough.  Any objections?


 My opinion does not count for much but I love Ruby openness and hate
 the naming conventions.  I much prefer camel case and .NET guidelines
 for naming than underscore and lowercase hell.  I am just getting
 started with Ruby and have no intention of following the naming
 conventions if I can avoid it.  IronRuby and .NET are my platform of
 choice for the future, even in its immature state.
 ___
 Ironruby-core mailing list
 Ironruby-core@rubyforge.org
 http://rubyforge.org/mailman/listinfo/ironruby-core


 ___
 Ironruby-core mailing list
 Ironruby-core@rubyforge.org
 http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-10-25 Thread Ted Milker
On Sat, Oct 25, 2008 at 6:59 PM, Orion Edwards
[EMAIL PROTECTED] wrote:
 While none of the languages will stop you from using any conventions you
 like, it's MUCH easier to learn to put your ego aside, and go with the
 conventions.

I agree, however, the DLR adds a twist to the formula.

 The simple fact is, you're going to be reading loads of sourcecode written
 by others in the form of examples and so forth, and if you get annoyed every
 time you see stuff you 'hate' - well you're going to be having a pretty
 unhappy time.

I do not get annoyed if I am reading or programming in a single
language.  I do like to keep things simple though.  If I am working in
.NET, I am going to keep a single, consistent style convention for my
source code.  I am not going to maintain two different conventions
just because I am using Ruby in half of my app and C# in the other.
Even if it were pure Ruby in IronRuby, I would use .NET guidelines
because I am almost certain to be using the .NET libraries in
IronRuby.  In this case and in my opinion, the framework determines
the convention, not the languages used.

One of the main reasons why I am interested in IronRuby is because it
will give me access to WPF.  GUIs with Ruby in Windows, I have
learned, is a pretty painful and overall annoying experience compared
to C# and WPF.

I do have a particular dislike for the underscore key because of its
placement on the keyboard as well.
___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-10-25 Thread Curt Hagenlocher
Let's say that w is a WPF window.  That is,
w = System::Windows::Window.new

Then you can currently get the actual height of the window by saying either
w.ActualHeight -or- w.actual_height.
This is something that we don't intend to change.

The nature of a dynamic call site is such that the method lookup is deferred 
until the point this code is reached, and then we're free to bind the actual 
call target using whatever semantics we please.  We don't even have to pay any 
real overhead for this ability, because we cache the result of the lookups 
after they were made the first time and don't have to perform them again.  
(Window *is* after all, a *static* type. :)

However, virtual calls from a C# application back into IronRuby are a different 
matter, due Ruby's dynamic nature.  Here there is both a performance cost and a 
semantic cost for performing multiple lookups.  The performance cost results 
from the fact that we have to check for two different symbol names on every CLS 
call to this method before we can identify that we need to delegate to the base 
class implementation.  (To be fair, this, too could be cached, albeit with 
slightly greater difficulty.)  The semantic cost is based in the confusion 
resulting when methods with both names are defined on the class.  Should we 
call method dispose or method Dispose? or both?

Finally, as you're probably aware by now, capitalization in Ruby is not simply 
a matter of convention.  In many cases, the parser actually treats identifiers 
which start with a capital letter differently than it does identifiers that 
start lower case.  Now it turns out that method names are one of the places 
where Ruby doesn't draw this distinction, but I'd guess that many Ruby 
programmers look at any identifier starting with a capital letter and think 
that's a constant.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ted Milker
Sent: Saturday, October 25, 2008 9:35 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Overriding CLS Virtuals

On Sat, Oct 25, 2008 at 6:59 PM, Orion Edwards
[EMAIL PROTECTED] wrote:
 While none of the languages will stop you from using any conventions you
 like, it's MUCH easier to learn to put your ego aside, and go with the
 conventions.

I agree, however, the DLR adds a twist to the formula.

 The simple fact is, you're going to be reading loads of sourcecode written
 by others in the form of examples and so forth, and if you get annoyed every
 time you see stuff you 'hate' - well you're going to be having a pretty
 unhappy time.

I do not get annoyed if I am reading or programming in a single
language.  I do like to keep things simple though.  If I am working in
.NET, I am going to keep a single, consistent style convention for my
source code.  I am not going to maintain two different conventions
just because I am using Ruby in half of my app and C# in the other.
Even if it were pure Ruby in IronRuby, I would use .NET guidelines
because I am almost certain to be using the .NET libraries in
IronRuby.  In this case and in my opinion, the framework determines
the convention, not the languages used.

One of the main reasons why I am interested in IronRuby is because it
will give me access to WPF.  GUIs with Ruby in Windows, I have
learned, is a pretty painful and overall annoying experience compared
to C# and WPF.

I do have a particular dislike for the underscore key because of its
placement on the keyboard as well.
___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-10-24 Thread Mike Moore
On Fri, Oct 24, 2008 at 7:11 PM, Ted Milker [EMAIL PROTECTED] wrote:


 I much prefer camel case and .NET guidelines for naming than underscore and
 lowercase hell.


You'd like it better if you'd call it snake case. :)
___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-09-16 Thread Curt Hagenlocher
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stefan Dobrev
Sent: Wednesday, September 10, 2008 2:46 PM
To: ironruby-core@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 [EMAIL PROTECTED]mailto:[EMAIL PROTECTED]

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

[EMAIL PROTECTED]mailto:[EMAIL PROTECTED]

___
Ironruby-core mailing list
Ironruby-core@rubyforge.orgmailto:Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-09-10 Thread Stefan Dobrev
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 [EMAIL PROTECTED]

  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

 [EMAIL PROTECTED]

 ___
 Ironruby-core mailing list
 Ironruby-core@rubyforge.org
 http://rubyforge.org/mailman/listinfo/ironruby-core


___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-09-09 Thread Jim Deville
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: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Brad Wilson [EMAIL 
PROTECTED]
Sent: Monday, September 08, 2008 9:39 PM
To: ironruby-core@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 [EMAIL PROTECTED]mailto:[EMAIL 
PROTECTED] 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@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-09-09 Thread Curt Hagenlocher
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jim Deville
Sent: Tuesday, September 09, 2008 1:01 AM
To: ironruby-core@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: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Brad Wilson [EMAIL 
PROTECTED]
Sent: Monday, September 08, 2008 9:39 PM
To: ironruby-core@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 [EMAIL PROTECTED]mailto:[EMAIL 
PROTECTED] 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@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-09-09 Thread Tomas Matousek
Let's revisit that later, I'm also not sure what the details were.

Tomas

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Curt Hagenlocher
Sent: Tuesday, September 09, 2008 4:40 AM
To: ironruby-core@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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jim Deville
Sent: Tuesday, September 09, 2008 1:01 AM
To: ironruby-core@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: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Brad Wilson [EMAIL 
PROTECTED]
Sent: Monday, September 08, 2008 9:39 PM
To: ironruby-core@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 [EMAIL PROTECTED]mailto:[EMAIL 
PROTECTED] 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@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-09-09 Thread Jim Deville
I know their naming convention is different, but lets see what JRuby does too.

JD


-Original Message-
From: Tomas Matousek [EMAIL PROTECTED]
Sent: September 09, 2008 8:55 AM
To: ironruby-core@rubyforge.org ironruby-core@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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Curt Hagenlocher
Sent: Tuesday, September 09, 2008 4:40 AM
To: ironruby-core@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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jim Deville
Sent: Tuesday, September 09, 2008 1:01 AM
To: ironruby-core@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: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Brad Wilson [EMAIL 
PROTECTED]
Sent: Monday, September 08, 2008 9:39 PM
To: ironruby-core@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 [EMAIL PROTECTED]mailto:[EMAIL 
PROTECTED] 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@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-09-09 Thread Curt Hagenlocher
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jim Deville
Sent: Tuesday, September 09, 2008 9:43 AM
To: ironruby-core@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 [EMAIL PROTECTED]
Sent: September 09, 2008 8:55 AM
To: ironruby-core@rubyforge.org ironruby-core@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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Curt Hagenlocher
Sent: Tuesday, September 09, 2008 4:40 AM
To: ironruby-core@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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jim Deville
Sent: Tuesday, September 09, 2008 1:01 AM
To: ironruby-core@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: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Brad Wilson [EMAIL 
PROTECTED]
Sent: Monday, September 08, 2008 9:39 PM
To: ironruby-core@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 [EMAIL PROTECTED]mailto:[EMAIL 
PROTECTED] 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@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-09-09 Thread Jim Deville
What if you do follow naming? Does def sayMultipleThings work?

JD

-Original Message-
From: Orion Edwards [EMAIL PROTECTED]
Sent: September 09, 2008 2:28 PM
To: ironruby-core@rubyforge.org ironruby-core@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 [EMAIL PROTECTED]mailto:[EMAIL PROTECTED]
Sent: September 09, 2008 9:44 AM
To: ironruby-core@rubyforge.orgmailto:ironruby-core@rubyforge.org 
ironruby-core@rubyforge.orgmailto:ironruby-core@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: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
Behalf Of Jim Deville
Sent: Tuesday, September 09, 2008 9:43 AM
To: ironruby-core@rubyforge.orgmailto:ironruby-core@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 [EMAIL PROTECTED]mailto:[EMAIL PROTECTED]
Sent: September 09, 2008 8:55 AM
To: ironruby-core@rubyforge.orgmailto:ironruby-core@rubyforge.org 
ironruby-core@rubyforge.orgmailto:ironruby-core@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: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
Behalf Of Curt Hagenlocher
Sent: Tuesday, September 09, 2008 4:40 AM
To: ironruby-core@rubyforge.orgmailto:ironruby-core@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: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
Behalf Of Jim Deville
Sent: Tuesday, September 09, 2008 1:01 AM
To: ironruby-core@rubyforge.orgmailto:ironruby-core@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: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] [EMAIL 
PROTECTED]mailto:[EMAIL PROTECTED]] On Behalf Of Brad Wilson [EMAIL 
PROTECTED]mailto:[EMAIL PROTECTED]]
Sent: Monday, September 08, 2008 9:39 PM
To: ironruby-core@rubyforge.orgmailto:ironruby-core@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 [EMAIL PROTECTED]mailto:[EMAIL 
PROTECTED]mailto:[EMAIL PROTECTED]mailto:[EMAIL PROTECTED] 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@rubyforge.orgmailto:Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Re: [Ironruby-core] Overriding CLS Virtuals

2008-09-09 Thread Orion Edwards




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 [EMAIL PROTECTED]
Sent: September 09, 2008 2:28 PM
To: ironruby-core@rubyforge.org ironruby-core@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 [EMAIL PROTECTED]
Sent: September 09, 2008 9:44 AM
To: ironruby-core@rubyforge.org ironruby-core@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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Jim Deville
Sent: Tuesday, September 09, 2008 9:43 AM
To: ironruby-core@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 [EMAIL PROTECTED]
Sent: September 09, 2008 8:55 AM
To: ironruby-core@rubyforge.org ironruby-core@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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Curt Hagenlocher
Sent: Tuesday, September 09, 2008 4:40 AM
To: ironruby-core@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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Jim Deville
Sent: Tuesday, September 09, 2008 1:01 AM
To: ironruby-core@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: [EMAIL PROTECTED] [[EMAIL PROTECTED]] On Behalf Of Brad Wilson [[EMAIL PROTECTED]]
Sent: Monday, September 08, 2008 9:39 PM
To: ironruby-core@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 [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] 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@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

___
Ironruby-core mailing list

Re: [Ironruby-core] Overriding CLS Virtuals

2008-09-08 Thread Curt Hagenlocher
Oops... that should have said include System::IDisposable.  My Outlook-based 
syntax checker is clearly not working.

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Curt Hagenlocher
Sent: Monday, September 08, 2008 9:22 PM
To: ironruby-core@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
[EMAIL PROTECTED]
___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-09-08 Thread Orion Edwards




You are my hero :-)

Curt Hagenlocher wrote:

  
  
  

  
  Ive 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.
  
  Were just getting started with better .NET
interop
support and dont 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
  [EMAIL PROTECTED]
  
  

___
Ironruby-core mailing list
Ironruby-core@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:   [EMAIL PROTECTED] 
 
 

 Open2view.com   

The Real Estate Website  

 


___
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


Re: [Ironruby-core] Overriding CLS Virtuals

2008-09-08 Thread Brad Wilson
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
[EMAIL PROTECTED]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@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core