[Ironruby-core] Lowercase classname

Tinco Andringa mail at tinco.nl
Sat Nov 20 18:22:04 EST 2010


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
>>
>
>


More information about the Ironruby-core mailing list