[Ironruby-core] Form Designer adding delegates
w.kelly at qut.edu.au
Thu Oct 25 00:29:32 EDT 2007
> -----Original Message-----
> From: ironruby-core-bounces at rubyforge.org
> [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of
> John Lam (DLR)
> Sent: Thursday, 25 October 2007 1:57 PM
> To: ironruby-core at rubyforge.org
> Subject: Re: [Ironruby-core] Form Designer adding delegates
> Wayne Kelly:
> > require 'mscorlib.dll'
> > require 'System.dll'
> > require 'System.Drawing.dll'
> > require 'System.Windows.Forms.dll'
> I'm a bit surprised at the use of assembly filenames vs.
> assembly names here
Don't all ruby requires expect a file name? We haven't changed the lookup mechanism for loading - we just allowed .NET dlls to also be loaded.
> Do they need to be on the path?
They need to be on Ruby's path, but we automatically add the Microsoft.NET framework directory to that Path.
> > @button1.set_Location(System::Drawing::Point.new(47, 54))
> Is there a reason why you're calling the property setter
> method explicitly rather than using the property name? Or is
> this not supported in the Ruby.Net method binder?
Our compiler would be happy with it as a property assignment, but we did it that way inside InitializeComponent in order to ensure round tripping. When parsing InitializeComponent and generating the codeDOM representation we need to distinguish between a field, a property and a method call. Statically typed languages are expected to use type information to distinguish. As we have no type information we use syntactic conventions to distinguish between them. Note - these syntactic conventions only apply within the InitializeComponent method which is typically auto-generated. Ruby programmers are free to use the more Rubyish syntax elsewhere in their code.
Another issue is statically distinguishing between variables such as Foo and type references such as System::Drawing::Point - we use wrapper/helper methods to distinguish type references (except when invoking a new method where we implicitly assume that the constant is a type reference). Again, this is only necessary inside IntializeComponent.
And now a question for your VS integration experts: when adding a new event handler - how do you arrange for the cursor to be automatically placed inside the body of the new method?
More information about the Ironruby-core