[Ironruby-core] IronRuby and Me

Martin Smith martin.smith.jr at gmail.com
Tue Nov 10 22:17:49 EST 2009


Gotcha... Thanks. I guess i've run into this myself with the
occasionally mangled name some_h_t_m_l, but that makes perfect sense.

Thanks,
Martin

On Tue, Nov 10, 2009 at 7:00 PM, Tomas Matousek
<Tomas.Matousek at microsoft.com> wrote:
> Yes, the reason is that .NET naming guidelines says that two-letter abbreviations are not camel-cased. That means we have names like GetIPAddress, PI, GetILGenerator etc. These are mangled to get_ip_address, pi, get_il_generator (not get_i_p_address, p_i, or get_i_l_generator). Unmangling is inverse of mangling (name == unmangle(mangle(name))), thus unmangling cannot turn "ip" into "Ip".
>
> Name-mangling is only heuristics. If some name doesn't follow the guidelines or is ambiguous (let's say "IT" in ITManager vs. "It" in ItJustWorks) then you need to use regular name.
>
> Tomas
>
> -----Original Message-----
> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Martin Smith
> Sent: Tuesday, November 10, 2009 6:36 PM
> To: ironruby-core at rubyforge.org
> Subject: Re: [Ironruby-core] IronRuby and Me
>
> Thanks guys.  Appreciate the (detailed) response.
>
> Actually, this explains quite a bit.  I've run into times sporadically where i'd be using the mangled name and it wouldn't be recognized and had no ready explanation for it.
>
> Is there a specific reason that two letter words arent mangled?  (I was looking in the comments of RubyUtils.cs but didn't find anything :-P ).
>
> Thanks,
> Martin
>
> On Tue, Nov 10, 2009 at 5:45 PM, Jimmy Schementi <Jimmy.Schementi at microsoft.com> wrote:
>> Martin,
>>
>> Expected, but also a bug. IronRuby will not provide a mangled name if the method name contains a 2-letter-word that is not in this list:
>>
>> as
>> by
>> do
>> id
>> it
>> if
>> in
>> is
>> go
>> my
>> of
>> ok
>> on
>> to
>> up
>>
>> This list is pretty arbitrary ... so "me" can probably be added to it. FYI, the code is in Merlin\Main\Languages\Ruby\Ruby\Runtime\RubyUtils.cs#TryMangleName (approx. line 298).
>>
>> ~Jimmy
>>
>>> -----Original Message-----
>>> From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-
>>> bounces at rubyforge.org] On Behalf Of Martin Smith
>>> Sent: Tuesday, November 10, 2009 4:48 PM
>>> To: ironruby-core at rubyforge.org
>>> Subject: [Ironruby-core] IronRuby and Me
>>>
>>> Hello again (sorry for the double post),
>>>
>>> We've noticed some slightly odd behavior.  IronRuby, it seems, won't
>>> mangle methods that have the word "Me" in them, so if I have a method:
>>>
>>> UncheckMeAndMyChildren, uncheck_me_and_my_children won't work
>>>
>>> but for:
>>>
>>> UncheckSelfAndMyChildren, uncheck_self_and_my_children DOES work.
>>>
>>> Is this a bug or the expected behavior?
>>>
>>> Thanks,
>>> Martin
>>> _______________________________________________
>>> 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