# Lower case namespace

**URL:** <https://www.ruby-forum.com/t/lower-case-namespace/188124>\
**Category:** IronRuby\
**Created:** [May 6, 2010, 8:40am UTC](https://www.ruby-forum.com/t/lower-case-namespace/188124 "2010-05-06T08:40:09Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@maxer](https://www.ruby-forum.com/u/maxer)\
**Post date:** [May 6, 2010, 8:40am UTC](https://www.ruby-forum.com/t/lower-case-namespace/188124/1 "2010-05-06T08:40:09Z")

</div>

Hy all,

I’m trying to use a 3rd party library into my app via IronRuby  
Unfortunately the root namespace of this library is lower case and I  
believe  
this cause some problem  
This is the sample code I wish to run

require “devDept.EyeshotUltimate”  
include devDept::Geometry  
o = Point3D.Origin  
puts o.x  
puts o.y  
puts o.z

but the second line throws the exception  
undefined method `devDept’ for main:Object (NoMethodError)

I think I know why this append  
([http://ironruby.net/Documentation/.NET/Names](http://ironruby.net/Documentation/.NET/Names)  
)  
“CLR namespaces and interfaces must be capitalized as they are mapped  
onto  
Ruby modules”

Since I can’t modify the 3rd party library is there a way to avoid this  
error ?  
Many thanks  
claudio

---

<div class="post-metadata">

**Author:** ![maxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@maxer](https://www.ruby-forum.com/u/maxer)\
**Post date:** [May 6, 2010, 8:53am UTC](https://www.ruby-forum.com/t/lower-case-namespace/188124/2 "2010-05-06T08:53:02Z")

</div>

you could try with:

Geometry = Object.const\_get(“devDept::Geometry”)  
include Geometry

I haven’t tried if this actually works though

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Web: [http://whiterabbitconsulting.eu](http://whiterabbitconsulting.eu) - [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))  
Microsoft IronRuby/C# MVP

On Thu, May 6, 2010 at 8:38 AM, Claudio M.

---

<div class="post-metadata">

**Author:** ![maxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@maxer](https://www.ruby-forum.com/u/maxer)\
**Post date:** [May 6, 2010, 8:57am UTC](https://www.ruby-forum.com/t/lower-case-namespace/188124/3 "2010-05-06T08:57:43Z")

</div>

I can think of a workaround (never checked it though) - create a C#  
assembly  
that adds a name alias to the assembly:

using DevDept = devDept;

and then require this assembly.

## Shay.

Shay F. | Microsoft Visual C#/IronRuby MVP | Author of IronRuby  
Unleashed  
Blog: [http://IronShay.com](http://IronShay.com) | Twitter: [http://twitter.com/ironshay](http://twitter.com/ironshay)

---

<div class="post-metadata">

**Author:** ![maxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@maxer](https://www.ruby-forum.com/u/maxer)\
**Post date:** [May 6, 2010, 9:24am UTC](https://www.ruby-forum.com/t/lower-case-namespace/188124/4 "2010-05-06T09:24:04Z")

</div>

Hi Ivan,

thank you for you prompt reply  
Now my code is

require “devDept.EyeshotUltimate”  
Geometry = Object.const\_get(“devDept::Geometry”)  
include Geometry  
o = Point3D.Origin  
puts o.x  
puts o.y  
puts o.z

When I run it I get this error:

C:\Users\cmaccari\Desktop\ironruby-1.0\bin\>ir devDept.rb  
devDept.rb:2:in `const_get':`devDept::Geometry’ is not allowed as a  
constant name (NameError)  
from devDept.rb:2

Any ideas

---

<div class="post-metadata">

**Author:** ![maxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@maxer](https://www.ruby-forum.com/u/maxer)\
**Post date:** [May 6, 2010, 9:39am UTC](https://www.ruby-forum.com/t/lower-case-namespace/188124/5 "2010-05-06T09:39:17Z")

</div>

But this assembly has no types inside right ?

---

<div class="post-metadata">

**Author:** ![maxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@maxer](https://www.ruby-forum.com/u/maxer)\
**Post date:** [May 6, 2010, 11:58am UTC](https://www.ruby-forum.com/t/lower-case-namespace/188124/6 "2010-05-06T11:58:01Z")

</div>

Right, no types, only an alias for the problematic namespace.I haven’t  
checked that though.

Let us know if you find a solution.

## Shay.

Shay F. | Microsoft Visual C#/IronRuby MVP | Author of IronRuby  
Unleashed  
Blog: [http://IronShay.com](http://IronShay.com) | Twitter: [http://twitter.com/ironshay](http://twitter.com/ironshay)

On Thu, May 6, 2010 at 10:36 AM, Claudio M.

---

<div class="post-metadata">

**Author:** ![maxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@maxer](https://www.ruby-forum.com/u/maxer)\
**Post date:** [May 6, 2010, 12:58pm UTC](https://www.ruby-forum.com/t/lower-case-namespace/188124/7 "2010-05-06T12:58:19Z")

</div>

you can use .NET reflection still  
the assembly is loaded but you can also interrogate it and get the types  
you  
need out and instantiate them that way.  
Not ideal but still worth a shot.

The aliasing won’t work I guess because that works at an assembly level,  
but  
if it does it’s good to know 🙂

## IronRuby doesn’t know extern alias which is what you’d need to use.

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Web: [http://whiterabbitconsulting.eu](http://whiterabbitconsulting.eu) - [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([IronRuby in Action - Ivan Porto Carrero and Adam Burmister | Manning](http://manning.com/carrero))  
Microsoft IronRuby/C# MVP

On Thu, May 6, 2010 at 9:21 AM, Claudio M.

---

<div class="post-metadata">

**Author:** ![maxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@maxer](https://www.ruby-forum.com/u/maxer)\
**Post date:** [May 6, 2010, 5:48pm UTC](https://www.ruby-forum.com/t/lower-case-namespace/188124/8 "2010-05-06T17:48:08Z")

</div>

The aliasing doesn’t work or I missed something ☹

---

<div class="post-metadata">

**Author:** ![maxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@maxer](https://www.ruby-forum.com/u/maxer)\
**Post date:** [May 6, 2010, 5:54pm UTC](https://www.ruby-forum.com/t/lower-case-namespace/188124/9 "2010-05-06T17:54:34Z")

</div>

Does anyone know if IronPython use the same convention?  
Will I have the same issue if I convert my ruby code to python ?

Thks  
makka

On Thu, May 6, 2010 at 5:46 PM, Claudio M.

---

<div class="post-metadata">

**Author:** ![maxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@maxer](https://www.ruby-forum.com/u/maxer)\
**Post date:** [May 6, 2010, 6:33pm UTC](https://www.ruby-forum.com/t/lower-case-namespace/188124/10 "2010-05-06T18:33:48Z")

</div>

This is almost right. You just need to split the constant lookup into 2  
parts and you should be good:

require “devDept.EyeshotUltimate”  
Geometry = Object.const\_get(“devDept”)::Geometry  
include Geometry  
o = Point3D.Origin  
puts o.x  
puts o.y  
puts o.z

Tomas

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Claudio  
Maccari  
Sent: Thursday, May 06, 2010 12:22 AM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] Lower case namespace

Hi Ivan,

thank you for you prompt reply  
Now my code is

require “devDept.EyeshotUltimate”  
Geometry = Object.const\_get(“devDept::Geometry”)  
include Geometry  
o = Point3D.Origin  
puts o.x  
puts o.y  
puts o.z

When I run it I get this error:

C:\Users\cmaccari\Desktop\ironruby-1.0\bin\>ir devDept.rb  
devDept.rb:2:in `const_get': `devDept::Geometry’ is not allowed as a  
constant name (NameError)  
from devDept.rb:2

Any ideas

On Thu, May 6, 2010 at 8:48 AM, Ivan Porto C.  
\<[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:  
you could try with:

Geometry = Object.const\_get(“devDept::Geometry”)  
include Geometry

I haven’t tried if this actually works though

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Web: [http://whiterabbitconsulting.eu](http://whiterabbitconsulting.eu) - [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([IronRuby in Action - Ivan Porto Carrero and Adam Burmister | Manning](http://manning.com/carrero))  
Microsoft IronRuby/C# MVP

On Thu, May 6, 2010 at 8:38 AM, Claudio M.  
\<[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:  
Hy all,

I’m trying to use a 3rd party library into my app via IronRuby  
Unfortunately the root namespace of this library is lower case and I  
believe this cause some problem  
This is the sample code I wish to run

require “devDept.EyeshotUltimate”  
include devDept::Geometry  
o = Point3D.Origin  
puts o.x  
puts o.y  
puts o.z

but the second line throws the exception  
undefined method `devDept’ for main:Object (NoMethodError)

I think I know why this append  
([http://ironruby.net/Documentation/.NET/Names](http://ironruby.net/Documentation/.NET/Names))  
“CLR namespaces and interfaces must be capitalized as they are mapped  
onto Ruby modules”

Since I can’t modify the 3rd party library is there a way to avoid this  
error ?  
Many thanks  
claudio

## – Claudio M.

> **[Just in time ideas](https://testdrivendevelopment.wordpress.com/)**
>
> Perchè le vostre idee devono diventare prodotti "Giusto in tempo" !!!

[http://twitter.com/scott4dev](http://twitter.com/scott4dev)

* * *

Ironruby-core mailing list  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

* * *

Ironruby-core mailing list  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

–  
Claudio M.

---

<div class="post-metadata">

**Author:** ![maxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@maxer](https://www.ruby-forum.com/u/maxer)\
**Post date:** [May 6, 2010, 6:34pm UTC](https://www.ruby-forum.com/t/lower-case-namespace/188124/11 "2010-05-06T18:34:23Z")

</div>

This won’t work since C# aliases are available only at compile time.  
They are not persisted in the resulting assembly.

Tomas

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Claudio  
Maccari  
Sent: Thursday, May 06, 2010 12:36 AM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Ironruby-core] Lower case namespace

But this assembly has no types inside right ?  
On Thu, May 6, 2010 at 8:55 AM, Shay F.  
\<[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:  
I can think of a workaround (never checked it though) - create a C#  
assembly that adds a name alias to the assembly:

using DevDept = devDept;

and then require this assembly.

## Shay.

Shay F. | Microsoft Visual C#/IronRuby MVP | Author of IronRuby  
Unleashed  
Blog: [http://IronShay.com](http://IronShay.com) | Twitter: [http://twitter.com/ironshay](http://twitter.com/ironshay)

On Thu, May 6, 2010 at 9:48 AM, Ivan Porto C.  
\<[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:  
you could try with:

Geometry = Object.const\_get(“devDept::Geometry”)  
include Geometry

I haven’t tried if this actually works though

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Web: [http://whiterabbitconsulting.eu](http://whiterabbitconsulting.eu) - [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([IronRuby in Action - Ivan Porto Carrero and Adam Burmister | Manning](http://manning.com/carrero))  
Microsoft IronRuby/C# MVP

On Thu, May 6, 2010 at 8:38 AM, Claudio M.  
\<[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:  
Hy all,

I’m trying to use a 3rd party library into my app via IronRuby  
Unfortunately the root namespace of this library is lower case and I  
believe this cause some problem  
This is the sample code I wish to run

require “devDept.EyeshotUltimate”  
include devDept::Geometry  
o = Point3D.Origin  
puts o.x  
puts o.y  
puts o.z

but the second line throws the exception  
undefined method `devDept’ for main:Object (NoMethodError)

I think I know why this append  
([http://ironruby.net/Documentation/.NET/Names](http://ironruby.net/Documentation/.NET/Names))  
“CLR namespaces and interfaces must be capitalized as they are mapped  
onto Ruby modules”

Since I can’t modify the 3rd party library is there a way to avoid this  
error ?  
Many thanks  
claudio

## – Claudio M.

> **[Just in time ideas](https://testdrivendevelopment.wordpress.com/)**
>
> Perchè le vostre idee devono diventare prodotti "Giusto in tempo" !!!

[http://twitter.com/scott4dev](http://twitter.com/scott4dev)

* * *

Ironruby-core mailing list  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

* * *

Ironruby-core mailing list  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

* * *

Ironruby-core mailing list  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

–  
Claudio M.

---

<div class="post-metadata">

**Author:** ![maxer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@maxer](https://www.ruby-forum.com/u/maxer)\
**Post date:** [May 8, 2010, 11:59am UTC](https://www.ruby-forum.com/t/lower-case-namespace/188124/12 "2010-05-08T11:59:05Z")

</div>

Amazing, now it works! 🙂  
Thank you very much Tomas!!!

Bye  
Claudio

On Thu, May 6, 2010 at 6:31 PM, Tomas M.  
\<removed\_email\_address@domain.invalid
