# Name mangling seems broken

**URL:** <https://www.ruby-forum.com/t/name-mangling-seems-broken/199518>\
**Category:** IronRuby\
**Created:** [November 23, 2010, 4:41am UTC](https://www.ruby-forum.com/t/name-mangling-seems-broken/199518 "2010-11-23T04:41:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [November 23, 2010, 4:41am UTC](https://www.ruby-forum.com/t/name-mangling-seems-broken/199518/1 "2010-11-23T04:41:20Z")

</div>

Hey guys,

I seem to have IronRuby name mangling in a rather inconsistent state.  
I was under the impression it would automagically work, but it seems  
it only changed the array #methods returns and not the actual methods  
it responds to…

> > > BWAPI::Bwapi.BWAPIClient.is\_connected  
> > > (ir):1: undefined method `is\_connected’ for BWAPI.Client:BWAPI::Client  
> > > (NoMethod  
> > > Error)
> 
> > > BWAPI::Bwapi.BWAPIClient.isConnected  
> > > =\> false
> 
> > > BWAPI::Bwapi.BWAPIClient.respond\_to? :isConnected  
> > > =\> true
> 
> > > BWAPI::Bwapi.BWAPIClient.respond\_to? :is\_connected  
> > > =\> false
> 
> > > BWAPI::Bwapi.BWAPIClient.methods - Object.new.methods  
> > > =\> [‘finalize’, ‘dispose’, ‘get\_hash\_code’, ‘equals’, ‘==’, ‘data=’,  
> > > ‘data’, ‘is  
> > > \_connected’, ‘connect’, ‘disconnect’, ‘update’, ‘swig\_c\_mem\_own’,  
> > > ‘swig\_c\_mem\_ow  
> > > n=’]
> 
> > > IRONRUBY\_VERSION  
> > > =\> “1.1.1.0”

So it does not respond to ‘is\_connected’ but ‘is\_connected’ is in the  
methods array.

Anyone an idea what I could have missed?

Greetings  
Tinco

---

<div class="post-metadata">

**Author:** ![Tinco\_Andringa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ea666f/32.png) [@Tinco\_Andringa](https://www.ruby-forum.com/u/Tinco_Andringa)\
**Post date:** [November 23, 2010, 4:59am UTC](https://www.ruby-forum.com/t/name-mangling-seems-broken/199518/2 "2010-11-23T04:59:31Z")

</div>

You can download the dll’s + test source at:  
[GitHub - tinco/bwapi-ironruby: An IronRuby interface for BWAPI a la RProxyBot](https://github.com/d-snp/bwapi-ironruby) it requires no setup. (source  
of the dll’s is: [Google Code Archive - Long-term storage for Google Code Project Hosting.](http://code.google.com/p/bwapi-mono-bridge/) not mine)

Cheers,  
Tinco

---

<div class="post-metadata">

**Author:** ![Tinco\_Andringa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ea666f/32.png) [@Tinco\_Andringa](https://www.ruby-forum.com/u/Tinco_Andringa)\
**Post date:** [November 24, 2010, 3:09am UTC](https://www.ruby-forum.com/t/name-mangling-seems-broken/199518/3 "2010-11-24T03:09:29Z")

</div>

The library doesn’t follow .NET naming conventions at all ☹

> > > BWAPI::Bwapi.BWAPIClient.respond\_to? :isConnected  
> > > =\> true

Client class has a method called “isConnected”.

> > > BWAPI::Bwapi.BWAPIClient.respond\_to? :is\_connected  
> > > =\> false

Client doesn’t have a method “IsConnected” nor “is\_connected” hence this  
returns false.

You are right. The list of method names should not include  
“is\_connected”. I’ve filed a bug:  
[http://ironruby.codeplex.com/workitem/5463](http://ironruby.codeplex.com/workitem/5463)

Tomas

---

<div class="post-metadata">

**Author:** ![Tinco\_Andringa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ea666f/32.png) [@Tinco\_Andringa](https://www.ruby-forum.com/u/Tinco_Andringa)\
**Post date:** [November 24, 2010, 12:19pm UTC](https://www.ruby-forum.com/t/name-mangling-seems-broken/199518/4 "2010-11-24T12:19:49Z")

</div>

I agree this is a total pain in the ass 😛 The library is a wrapper  
around a c++ library generated by SWIG so that’s why the conventions  
are so blatantly disregarded.

Thanks for dealing with this annoying edgecase 🙂

Greetings,  
Tinco

On Wed, Nov 24, 2010 at 02:43, Tomas M.
