Hey guys, I''m using IronRuby to interface with a clr library. There is a small problem however: It has one class that does not start with a capital letter. This causes IronRuby to just not see the class since ruby does not support lowercase constantnames. Does anyone know if it''s possible to work around this in IronRuby (like somehow getting a reference to it with a string, and then assigning it to different ruby constant)? Or should I make my own clr dll that exposes the class with a different (uppercased) name? Cheers, Tinco Andringa (simkor.nl)
Hmm I''ve found the documentation for IronRuby now :P It says class names should automatically be capitalized. This however seems not to have happened since it plainly isn''t available. I have worked around the issue by renaming it in the source, but this forces me to ship precompiled dll''s instead of referencing the other framework. Should I file a bugreport? This is on the 1.1.1 release :) Cheers, Tinco On Thu, Nov 18, 2010 at 15:17, Tinco Andringa <mail at tinco.nl> wrote:> Hey guys, > > I''m using IronRuby to interface with a clr library. There is a small > problem however: It has one class that does not start with a capital > letter. This causes IronRuby to just not see the class since ruby does > not support lowercase constantnames. Does anyone know if it''s possible > to work around this in IronRuby (like somehow getting a reference to > it with a string, and then assigning it to different ruby constant)? > Or should I make my own clr dll that exposes the class with a > different (uppercased) name? > > Cheers, > Tinco Andringa (simkor.nl) >
This might be a bug in the documentation :-)? Method names are mangled so that you can use foo_bar to call FooBar method. You should be able to use const_get(:foo) to get to the constant. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tinco Andringa Sent: Thursday, November 18, 2010 3:01 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Lowercase classname Hmm I''ve found the documentation for IronRuby now :P It says class names should automatically be capitalized. This however seems not to have happened since it plainly isn''t available. I have worked around the issue by renaming it in the source, but this forces me to ship precompiled dll''s instead of referencing the other framework. Should I file a bugreport? This is on the 1.1.1 release :) Cheers, Tinco On Thu, Nov 18, 2010 at 15:17, Tinco Andringa <mail at tinco.nl> wrote:> Hey guys, > > I''m using IronRuby to interface with a clr library. There is a small > problem however: It has one class that does not start with a capital > letter. This causes IronRuby to just not see the class since ruby does > not support lowercase constantnames. Does anyone know if it''s possible > to work around this in IronRuby (like somehow getting a reference to > it with a string, and then assigning it to different ruby constant)? > Or should I make my own clr dll that exposes the class with a > different (uppercased) name? > > Cheers, > Tinco Andringa (simkor.nl) >_______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Hey Tomas, Thanks for the reply. const_get :foo also raises the constants should begin with an uppercase letter error :) Object.const_get :foo (ir):1:in `const_get'': `foo'' is not allowed as a constant name (NameError) from (ir):1 Cheers, Tinco On Fri, Nov 19, 2010 at 00:32, Tomas Matousek <Tomas.Matousek at microsoft.com> wrote:> This might be a bug in the documentation :-)? Method names are mangled so that you can use foo_bar ?to call FooBar method. > > You should be able to use const_get(:foo) to get to the constant. > > Tomas > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tinco Andringa > Sent: Thursday, November 18, 2010 3:01 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Lowercase classname > > Hmm I''ve found the documentation for IronRuby now :P It says class names should automatically be capitalized. This however seems not to have happened since it plainly isn''t available. I have worked around the issue by renaming it in the source, but this forces me to ship precompiled dll''s instead of referencing the other framework. > > Should I file a bugreport? This is on the 1.1.1 release :) > > Cheers, > Tinco > > On Thu, Nov 18, 2010 at 15:17, Tinco Andringa <mail at tinco.nl> wrote: >> Hey guys, >> >> I''m using IronRuby to interface with a clr library. There is a small >> problem however: It has one class that does not start with a capital >> letter. This causes IronRuby to just not see the class since ruby does >> not support lowercase constantnames. Does anyone know if it''s possible >> to work around this in IronRuby (like somehow getting a reference to >> it with a string, and then assigning it to different ruby constant)? >> Or should I make my own clr dll that exposes the class with a >> different (uppercased) name? >> >> Cheers, >> Tinco Andringa (simkor.nl) >> > _______________________________________________ > 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 >
Look here: http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespaces-and-Classes-in-IronRuby.aspx <http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespaces-and-Classes-in-IronRuby.aspx> Shay. On Fri, Nov 19, 2010 at 3:34 PM, Tinco Andringa <mail at tinco.nl> wrote:> Hey Tomas, > > Thanks for the reply. const_get :foo also raises the constants should > begin with an uppercase letter error :) > > Object.const_get :foo > (ir):1:in `const_get'': `foo'' is not allowed as a constant name (NameError) > from (ir):1 > > Cheers, > Tinco > > On Fri, Nov 19, 2010 at 00:32, Tomas Matousek > <Tomas.Matousek at microsoft.com> wrote: > > This might be a bug in the documentation :-)? Method names are mangled so > that you can use foo_bar to call FooBar method. > > > > You should be able to use const_get(:foo) to get to the constant. > > > > Tomas > > > > -----Original Message----- > > From: ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] On Behalf Of Tinco Andringa > > Sent: Thursday, November 18, 2010 3:01 PM > > To: ironruby-core at rubyforge.org > > Subject: Re: [Ironruby-core] Lowercase classname > > > > Hmm I''ve found the documentation for IronRuby now :P It says class names > should automatically be capitalized. This however seems not to have happened > since it plainly isn''t available. I have worked around the issue by renaming > it in the source, but this forces me to ship precompiled dll''s instead of > referencing the other framework. > > > > Should I file a bugreport? This is on the 1.1.1 release :) > > > > Cheers, > > Tinco > > > > On Thu, Nov 18, 2010 at 15:17, Tinco Andringa <mail at tinco.nl> wrote: > >> Hey guys, > >> > >> I''m using IronRuby to interface with a clr library. There is a small > >> problem however: It has one class that does not start with a capital > >> letter. This causes IronRuby to just not see the class since ruby does > >> not support lowercase constantnames. Does anyone know if it''s possible > >> to work around this in IronRuby (like somehow getting a reference to > >> it with a string, and then assigning it to different ruby constant)? > >> Or should I make my own clr dll that exposes the class with a > >> different (uppercased) name? > >> > >> Cheers, > >> Tinco Andringa (simkor.nl) > >> > > _______________________________________________ > > 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20101119/d101d363/attachment.html>
On Fri, Nov 19, 2010 at 2:41 PM, Shay Friedman <shay.friedman at gmail.com>wrote:> Look here: > http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespaces-and-Classes-in-IronRuby.aspx > <http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespaces-and-Classes-in-IronRuby.aspx> > Shay. >Excellent solution. I mean, really, all the C# classes should start with an uppercase letter, thats basically a standard, therefore this should be the only solution and I don''t see no need to actually hack this otherwise into IronRuby. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20101119/c30730ee/attachment-0001.html>
This is only an acceptable solution if the user has the source code and is capable of modifying it. For how I test things with IronRuby, this isn''t always possible. Seems odd to me that one of the most flexible language I know of can''t read/integrate with another language due to code not following a rigid structure. Doesn''t IronPython allow for this? I was fairly sure I could import non-standard .Net convention based code into it. -Andrew On Fri, Nov 19, 2010 at 2:41 PM, Shay Friedman <shay.friedman at gmail.com>wrote: > Look here: >http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespaces-and-Classes-in-IronRuby.aspx> <http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespaces-and-Classes-in-IronRuby.aspx> > Shay. >Excellent solution. I mean, really, all the C# classes should start with an uppercase letter, thats basically a standard, therefore this should be the only solution and I don''t see no need to actually hack this otherwise into IronRuby. -- ?If I had six hours to chop down a tree, I?d spend the first four of them sharpening my axe?. -Abraham Lincoln -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20101119/8b31dc21/attachment.html>
Andrew, Not sure I follow. IronRuby does support this via DotNetClassName Object.const_get("lower_case_dotnet_class_name"), so you don''t need to change your code. This is an issue because of Ruby itself; classes are required to be Ruby constants, which syntactically can only start with an upper-case letter. Since IronRuby is syntactically equivalent to Ruby, we will not remove this rule. Instead, we either suggest changing your C# code, or if you can''t, use const_get. WRT your IronPython comment, it doesn''t have this issue because the Python language doesn''t enforce a naming scheme on type names. ~Jimmy On Fri, Nov 19, 2010 at 10:48 AM, andrew Wilson <a.wilson82 at gmail.com>wrote:> This is only an acceptable solution if the user has the source code and is > capable of modifying it. For how I test things with IronRuby, this isn''t > always possible. Seems odd to me that one of the most flexible language I > know of can''t read/integrate with another language due to code not following > a rigid structure. > > Doesn''t IronPython allow for this? I was fairly sure I could import > non-standard .Net convention based code into it. > > -Andrew > > > On Fri, Nov 19, 2010 at 2:41 PM, Shay Friedman <shay.friedman at gmail.com > >wrote: > > Look here: > > > http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespaces-and-Classes-in-IronRuby.aspx > > < > http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespaces-and-Classes-in-IronRuby.aspx > > > > Shay. > > > Excellent solution. I mean, really, all the C# classes should start with an > uppercase letter, thats basically a standard, therefore this should be the > only solution and I don''t see no need to actually hack this otherwise into > IronRuby. > > > -- > ?If I had six hours to chop down a tree, I?d spend the first four of them > sharpening my axe?. > > -Abraham Lincoln > > _______________________________________________ > 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/20101119/2d914eb6/attachment.html>
On Fri, Nov 19, 2010 at 4:48 PM, andrew Wilson <a.wilson82 at gmail.com> wrote:> This is only an acceptable solution if the user has the source code and is > capable of modifying it. For how I test things withWhy? Just use ''LowerCase = get_const("lowerCase")''. Actually I don''t understand why one would code C# using camelStyle. The standard is CamelStyle.> IronRuby, this isn''t always possible. Seems odd to me that one of the most > flexible language I know of can''t read/integrate with another language due > to code not following a rigid structure.The fact that it is dynamic does not implicate that IronRuby should be able to read all kind of crazy naming styles, it should implicate the you could modify it to your needs with minimum amount of coding, just add something like this before you use that library in ruby: modul.constants.each do |const| eval "#{const.uppercase} = modul.const_get(const)" end This is only semi-pseudocode, but you should get the idea. Doesn''t IronPython allow for this? I was fairly sure I could import> non-standard .Net convention based code into it. >True or False. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20101119/e022c86e/attachment.html>
Ruby can do crazy stuff but it doesn''t support one thing that C# does - camelCase names for classes and modules (because they''re eventually constants). It just can''t be done. Taking this into consideration, what name would you expect a camelCased C# class name get in IronRuby? its PascalCased form? and what if there are two classes in the C# assembly, one named camelCase and the second CamelCase - totally legit in C#... what would you expect to happen then? It''s a problematic situation and I think IronRuby goes with the right solution here. Shay. On Fri, Nov 19, 2010 at 6:05 PM, Andrius Bentkus <andrius.bentkus at gmail.com>wrote:> On Fri, Nov 19, 2010 at 4:48 PM, andrew Wilson <a.wilson82 at gmail.com>wrote: > >> This is only an acceptable solution if the user has the source code and is >> capable of modifying it. For how I test things with > > > Why? Just use ''LowerCase = get_const("lowerCase")''. > Actually I don''t understand why one would code C# using camelStyle. The > standard is CamelStyle. > > >> IronRuby, this isn''t always possible. Seems odd to me that one of the >> most flexible language I know of can''t read/integrate with another language >> due to code not following a rigid structure. > > > The fact that it is dynamic does not implicate that IronRuby should be able > to read all kind of crazy naming styles, it should implicate the you could > modify it to your needs with minimum amount of coding, just add something > like this before you use that library in ruby: > > modul.constants.each do |const| > eval "#{const.uppercase} = modul.const_get(const)" > end > > This is only semi-pseudocode, but you should get the idea. > > Doesn''t IronPython allow for this? I was fairly sure I could import >> non-standard .Net convention based code into it. >> > > True or False. > > _______________________________________________ > 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/20101119/50527020/attachment-0001.html>
I disagree. You don''t need to be able to modify the .NET source code to get this to work. You can use Ruby to make Ruby happy. The reason for the friction is because .NET != Ruby. When you create a class in Ruby, you are actually creating an object that inherits from Class, and then you are creating a constant that points to that object. In Ruby all constants start with an upper case character. Ruby doesn''t allow you to create a class that starts with a lower case letter. > class foo; def to_s; puts ''wha?!''; end; end SyntaxError: (irb):1: class/module name must be CONSTANT class foo; def to_s; puts ''wha?!''; end; end ^ IronRuby does a lot of work to match Ruby''s conventions of snake_case methods, but it cannot resolve a lower case namespace or class from .NET. I think IronRuby is doing the right thing here. Its very simple to setup your Ruby constants that point to your .NET namespaces and classes using the method shown in the URL provided. Foo = Object.const_get("foo") Foo::Bar = Foo.const_get("bar") bar = Foo::Bar.new Ruby is awesome but it is not infinitely flexible. You gotta jump to Lisp for that. :) On Fri, Nov 19, 2010 at 8:48 AM, andrew Wilson <a.wilson82 at gmail.com> wrote:> This is only an acceptable solution if the user has the source code and is > capable of modifying it. For how I test things with IronRuby, this isn''t > always possible. Seems odd to me that one of the most flexible language I > know of can''t read/integrate with another language due to code not following > a rigid structure. > > Doesn''t IronPython allow for this? I was fairly sure I could import > non-standard .Net convention based code into it. > > -Andrew > > > On Fri, Nov 19, 2010 at 2:41 PM, Shay Friedman <shay.friedman at gmail.com > >wrote: > > Look here: > > > http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespaces-and-Classes-in-IronRuby.aspx > > < > http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespaces-and-Classes-in-IronRuby.aspx > > > > Shay. > > > Excellent solution. I mean, really, all the C# classes should start with an > uppercase letter, thats basically a standard, therefore this should be the > only solution and I don''t see no need to actually hack this otherwise into > IronRuby. > > > -- > ?If I had six hours to chop down a tree, I?d spend the first four of them > sharpening my axe?. > > -Abraham Lincoln > > _______________________________________________ > 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/20101119/3487a096/attachment.html>
For some reason Jimmy''s reply didn''t show up in my inbox until I sent my reply. Sorry for the duplicate explanation. On Fri, Nov 19, 2010 at 9:00 AM, Jimmy Schementi <jimmy at schementi.com>wrote:> Andrew, > > Not sure I follow. IronRuby does support this via DotNetClassName > Object.const_get("lower_case_dotnet_class_name"), so you don''t need to > change your code. This is an issue because of Ruby itself; classes are > required to be Ruby constants, which syntactically can only start with an > upper-case letter. Since IronRuby is syntactically equivalent to Ruby, we > will not remove this rule. Instead, we either suggest changing your C# code, > or if you can''t, use const_get. WRT your IronPython comment, it doesn''t have > this issue because the Python language doesn''t enforce a naming scheme on > type names. > > ~Jimmy > > > On Fri, Nov 19, 2010 at 10:48 AM, andrew Wilson <a.wilson82 at gmail.com>wrote: > >> This is only an acceptable solution if the user has the source code and is >> capable of modifying it. For how I test things with IronRuby, this isn''t >> always possible. Seems odd to me that one of the most flexible language I >> know of can''t read/integrate with another language due to code not following >> a rigid structure. >> >> Doesn''t IronPython allow for this? I was fairly sure I could import >> non-standard .Net convention based code into it. >> >> -Andrew >> >> >> On Fri, Nov 19, 2010 at 2:41 PM, Shay Friedman <shay.friedman at gmail.com >> >wrote: >> > Look here: >> > >> http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespaces-and-Classes-in-IronRuby.aspx >> > < >> http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespaces-and-Classes-in-IronRuby.aspx >> > >> > Shay. >> > >> Excellent solution. I mean, really, all the C# classes should start with >> an >> uppercase letter, thats basically a standard, therefore this should be the >> only solution and I don''t see no need to actually hack this otherwise into >> IronRuby. >> >> >> -- >> ?If I had six hours to chop down a tree, I?d spend the first four of them >> sharpening my axe?. >> >> -Abraham Lincoln >> >> _______________________________________________ >> 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/20101119/ec046d39/attachment.html>
Hey guys.. it''s very nice that you all say the same thing, but it doesn''t work in IronRuby 1.1.1:>>> Object.const_get "foo"(ir):1:in `const_get'': `foo'' is not allowed as a constant name (NameError) from (ir):1 If this would''ve worked then I wouldn''t have had to ask the question in the first place :) Kind regards, Tinco Andringa On Fri, Nov 19, 2010 at 6:43 PM, Mike Moore <blowmage at gmail.com> wrote:> For some reason Jimmy''s reply didn''t show up in my inbox until I sent my > reply. Sorry for the duplicate explanation. > > On Fri, Nov 19, 2010 at 9:00 AM, Jimmy Schementi <jimmy at schementi.com> > wrote: >> >> Andrew, >> Not sure I follow. IronRuby does support this via DotNetClassName >> Object.const_get("lower_case_dotnet_class_name"), so you don''t need to >> change your code. This is an issue because of Ruby itself; classes are >> required to be Ruby constants, which syntactically can only start with an >> upper-case letter. Since IronRuby is syntactically equivalent to Ruby, we >> will not remove this rule. Instead, we either suggest changing your C# code, >> or if you can''t, use const_get. WRT your IronPython comment, it doesn''t have >> this issue because the Python language doesn''t enforce a naming scheme on >> type names. >> ~Jimmy >> >> >> On Fri, Nov 19, 2010 at 10:48 AM, andrew Wilson <a.wilson82 at gmail.com> >> wrote: >>> >>> This is only an acceptable solution if the user has the source code and >>> is capable of modifying it. ?For how I test things with IronRuby, this isn''t >>> always possible. ?Seems odd to me that one of the most flexible language I >>> know of can''t read/integrate with another language due to code not following >>> a rigid structure. >>> Doesn''t IronPython allow for this? ?I was fairly sure I could import >>> non-standard .Net convention based code into it. >>> -Andrew >>> >>> On Fri, Nov 19, 2010 at 2:41 PM, Shay Friedman >>> <shay.friedman at gmail.com>wrote: >>> > Look here: >>> >>> > >?http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespaces-and-Classes-in-IronRuby.aspx >>> > >>> > <http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespaces-and-Classes-in-IronRuby.aspx> >>> > Shay. >>> > >>> Excellent solution. I mean, really, all the C# classes should start with >>> an >>> uppercase letter, thats basically a standard, therefore this should be >>> the >>> only solution and I don''t see no need to actually hack this otherwise >>> into >>> IronRuby. >>> >>> -- >>> ?If I had six hours to chop down a tree, I?d spend the first four of them >>> sharpening my axe?. >>> >>> -Abraham Lincoln >>> >>> _______________________________________________ >>> 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 > >
Can you send a link to the assembly that defines the class you are trying to use? Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tinco Andringa Sent: Saturday, November 20, 2010 2:27 PM To: ironruby-core Subject: Re: [Ironruby-core] Lowercase classname Hey guys.. it''s very nice that you all say the same thing, but it doesn''t work in IronRuby 1.1.1:>>> Object.const_get "foo"(ir):1:in `const_get'': `foo'' is not allowed as a constant name (NameError) from (ir):1 If this would''ve worked then I wouldn''t have had to ask the question in the first place :) Kind regards, Tinco Andringa On Fri, Nov 19, 2010 at 6:43 PM, Mike Moore <blowmage at gmail.com> wrote:> For some reason Jimmy''s reply didn''t show up in my inbox until I sent > my reply. Sorry for the duplicate explanation. > > On Fri, Nov 19, 2010 at 9:00 AM, Jimmy Schementi <jimmy at schementi.com> > wrote: >> >> Andrew, >> Not sure I follow. IronRuby does support this via DotNetClassName = >> Object.const_get("lower_case_dotnet_class_name"), so you don''t need >> to change your code. This is an issue because of Ruby itself; classes >> are required to be Ruby constants, which syntactically can only start >> with an upper-case letter. Since IronRuby is syntactically equivalent >> to Ruby, we will not remove this rule. Instead, we either suggest >> changing your C# code, or if you can''t, use const_get. WRT your >> IronPython comment, it doesn''t have this issue because the Python >> language doesn''t enforce a naming scheme on type names. >> ~Jimmy >> >> >> On Fri, Nov 19, 2010 at 10:48 AM, andrew Wilson >> <a.wilson82 at gmail.com> >> wrote: >>> >>> This is only an acceptable solution if the user has the source code >>> and is capable of modifying it. ?For how I test things with >>> IronRuby, this isn''t always possible. ?Seems odd to me that one of >>> the most flexible language I know of can''t read/integrate with >>> another language due to code not following a rigid structure. >>> Doesn''t IronPython allow for this? ?I was fairly sure I could import >>> non-standard .Net convention based code into it. >>> -Andrew >>> >>> On Fri, Nov 19, 2010 at 2:41 PM, Shay Friedman >>> <shay.friedman at gmail.com>wrote: >>> > Look here: >>> >>> > >? >>> > >http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespace >>> > >s-and-Classes-in-IronRuby.aspx >>> > >>> > <http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespace >>> > s-and-Classes-in-IronRuby.aspx> >>> > Shay. >>> > >>> Excellent solution. I mean, really, all the C# classes should start >>> with an uppercase letter, thats basically a standard, therefore this >>> should be the only solution and I don''t see no need to actually hack >>> this otherwise into IronRuby. >>> >>> -- >>> ?If I had six hours to chop down a tree, I?d spend the first four of >>> them sharpening my axe?. >>> >>> -Abraham Lincoln >>> >>> _______________________________________________ >>> 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
http://code.google.com/p/bwapi-mono-bridge/ here it is :) Thanks On Sat, Nov 20, 2010 at 11:53 PM, Tomas Matousek <Tomas.Matousek at microsoft.com> wrote:> Can you send a link to the assembly that defines the class you are trying to > use? > > Tomas > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org > [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tinco Andringa > Sent: Saturday, November 20, 2010 2:27 PM > To: ironruby-core > Subject: Re: [Ironruby-core] Lowercase classname > > Hey guys.. it''s very nice that you all say the same thing, but it doesn''t > work in IronRuby 1.1.1: > >>>> Object.const_get "foo" > (ir):1:in `const_get'': `foo'' is not allowed as a constant name (NameError) > ? ? ? ?from (ir):1 > > If this would''ve worked then I wouldn''t have had to ask the question in the > first place :) > > Kind regards, > Tinco Andringa > > On Fri, Nov 19, 2010 at 6:43 PM, Mike Moore <blowmage at gmail.com> wrote: >> For some reason Jimmy''s reply didn''t show up in my inbox until I sent >> my reply. Sorry for the duplicate explanation. >> >> On Fri, Nov 19, 2010 at 9:00 AM, Jimmy Schementi <jimmy at schementi.com> >> wrote: >>> >>> Andrew, >>> Not sure I follow. IronRuby does support this via DotNetClassName >>> Object.const_get("lower_case_dotnet_class_name"), so you don''t need >>> to change your code. This is an issue because of Ruby itself; classes >>> are required to be Ruby constants, which syntactically can only start >>> with an upper-case letter. Since IronRuby is syntactically equivalent >>> to Ruby, we will not remove this rule. Instead, we either suggest >>> changing your C# code, or if you can''t, use const_get. WRT your >>> IronPython comment, it doesn''t have this issue because the Python >>> language doesn''t enforce a naming scheme on type names. >>> ~Jimmy >>> >>> >>> On Fri, Nov 19, 2010 at 10:48 AM, andrew Wilson >>> <a.wilson82 at gmail.com> >>> wrote: >>>> >>>> This is only an acceptable solution if the user has the source code >>>> and is capable of modifying it. ?For how I test things with >>>> IronRuby, this isn''t always possible. ?Seems odd to me that one of >>>> the most flexible language I know of can''t read/integrate with >>>> another language due to code not following a rigid structure. >>>> Doesn''t IronPython allow for this? ?I was fairly sure I could import >>>> non-standard .Net convention based code into it. >>>> -Andrew >>>> >>>> On Fri, Nov 19, 2010 at 2:41 PM, Shay Friedman >>>> <shay.friedman at gmail.com>wrote: >>>> > Look here: >>>> >>>> > > >>>> > >http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespace >>>> > >s-and-Classes-in-IronRuby.aspx >>>> > >>>> > <http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespace >>>> > s-and-Classes-in-IronRuby.aspx> >>>> > Shay. >>>> > >>>> Excellent solution. I mean, really, all the C# classes should start >>>> with an uppercase letter, thats basically a standard, therefore this >>>> should be the only solution and I don''t see no need to actually hack >>>> this otherwise into IronRuby. >>>> >>>> -- >>>> ?If I had six hours to chop down a tree, I?d spend the first four of >>>> them sharpening my axe?. >>>> >>>> -Abraham Lincoln >>>> >>>> _______________________________________________ >>>> 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 >
Okey, I just tried it myself on those assemblies, and now I find it actually does work :D Sorry guys :) I was thrown off by the error that is thrown when the constant with the lower case name doesn''t exist. I failed at first because I tried Object.const_get(''bwapi'') instead of BWAPI.const_get(''bwapi''). Thanks for the tips :) On Sun, Nov 21, 2010 at 12:08 AM, Tinco Andringa <mail at tinco.nl> wrote:> http://code.google.com/p/bwapi-mono-bridge/ here it is :) > > Thanks > > On Sat, Nov 20, 2010 at 11:53 PM, Tomas Matousek <Tomas.Matousek at microsoft.com> wrote: >> Can you send a link to the assembly that defines the class you are trying to >> use? >> >> Tomas >> >> -----Original Message----- >> From: ironruby-core-bounces at rubyforge.org >> [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tinco Andringa >> Sent: Saturday, November 20, 2010 2:27 PM >> To: ironruby-core >> Subject: Re: [Ironruby-core] Lowercase classname >> >> Hey guys.. it''s very nice that you all say the same thing, but it doesn''t >> work in IronRuby 1.1.1: >> >>>>> Object.const_get "foo" >> (ir):1:in `const_get'': `foo'' is not allowed as a constant name (NameError) >> ? ? ? ?from (ir):1 >> >> If this would''ve worked then I wouldn''t have had to ask the question in the >> first place :) >> >> Kind regards, >> Tinco Andringa >> >> On Fri, Nov 19, 2010 at 6:43 PM, Mike Moore <blowmage at gmail.com> wrote: >>> For some reason Jimmy''s reply didn''t show up in my inbox until I sent >>> my reply. Sorry for the duplicate explanation. >>> >>> On Fri, Nov 19, 2010 at 9:00 AM, Jimmy Schementi <jimmy at schementi.com> >>> wrote: >>>> >>>> Andrew, >>>> Not sure I follow. IronRuby does support this via DotNetClassName >>>> Object.const_get("lower_case_dotnet_class_name"), so you don''t need >>>> to change your code. This is an issue because of Ruby itself; classes >>>> are required to be Ruby constants, which syntactically can only start >>>> with an upper-case letter. Since IronRuby is syntactically equivalent >>>> to Ruby, we will not remove this rule. Instead, we either suggest >>>> changing your C# code, or if you can''t, use const_get. WRT your >>>> IronPython comment, it doesn''t have this issue because the Python >>>> language doesn''t enforce a naming scheme on type names. >>>> ~Jimmy >>>> >>>> >>>> On Fri, Nov 19, 2010 at 10:48 AM, andrew Wilson >>>> <a.wilson82 at gmail.com> >>>> wrote: >>>>> >>>>> This is only an acceptable solution if the user has the source code >>>>> and is capable of modifying it. ?For how I test things with >>>>> IronRuby, this isn''t always possible. ?Seems odd to me that one of >>>>> the most flexible language I know of can''t read/integrate with >>>>> another language due to code not following a rigid structure. >>>>> Doesn''t IronPython allow for this? ?I was fairly sure I could import >>>>> non-standard .Net convention based code into it. >>>>> -Andrew >>>>> >>>>> On Fri, Nov 19, 2010 at 2:41 PM, Shay Friedman >>>>> <shay.friedman at gmail.com>wrote: >>>>> > Look here: >>>>> >>>>> > > >>>>> > >http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespace >>>>> > >s-and-Classes-in-IronRuby.aspx >>>>> > >>>>> > <http://www.ironshay.com/post/Working-with-NET-Lowercase-Namespace >>>>> > s-and-Classes-in-IronRuby.aspx> >>>>> > Shay. >>>>> > >>>>> Excellent solution. I mean, really, all the C# classes should start >>>>> with an uppercase letter, thats basically a standard, therefore this >>>>> should be the only solution and I don''t see no need to actually hack >>>>> this otherwise into IronRuby. >>>>> >>>>> -- >>>>> ?If I had six hours to chop down a tree, I?d spend the first four of >>>>> them sharpening my axe?. >>>>> >>>>> -Abraham Lincoln >>>>> >>>>> _______________________________________________ >>>>> 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 >> > >