You can always use const_get for the 1% cases. IMO, having non-capitalized 
namespaces and classes is already 1% case, since such libraries violate .NET 
design guidelines.

Tomas

From: ironruby-core-boun...@rubyforge.org 
[mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Charles Strahan
Sent: Sunday, March 27, 2011 4:19 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] IronRuby not loading DLL

I figured that it's always nice to have options - especially if there are 
conflicts.  Capitalizing the first letter would probably work in 99% of cases, 
but I could imagine there might be case where you have an xFoo type and an XFoo 
type in the same namespace.

That's probably being pedantic though - just capitalizing the first letter 
sounds like a pragmatic solution to me.

-Charles
On Sat, Mar 26, 2011 at 10:01 PM, Tomas Matousek 
<tomas.matou...@microsoft.com<mailto:tomas.matou...@microsoft.com>> wrote:
What would such block usually do? Uppercase the first letter of a lower-cased 
class/namespace? We could do that or some other mangling automatically. Is 
there any value in customizing the mangling?

Being it automatic would help you to discover the constants since they would 
appear in Module#constants.

Tomas

From: 
ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org> 
[mailto:ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org>]
 On Behalf Of Charles Strahan
Sent: Saturday, March 26, 2011 10:00 AM

To: ironruby-core@rubyforge.org<mailto:ironruby-core@rubyforge.org>
Subject: Re: [Ironruby-core] IronRuby not loading DLL

Tomas, how would you feel about adding an optional block param to 
require/load_assembly for overriding how .NET types are mapped to constants?  
That might be prove beneficial in cases such as these.

-Charles

On Fri, Mar 25, 2011 at 5:37 PM, Tomas Matousek 
<tomas.matou...@microsoft.com<mailto:tomas.matou...@microsoft.com>> wrote:
You need to use const_get to access classes/namespaces whose names are not 
compatible with Ruby naming conventions.
A module in Ruby must start with capital ASCII letter.

const_get(:mdMATCHUPOBJECTLib).const_get(:mdMUIncrementalClass).new should work.

Tomas

-----Original Message-----
From: 
ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org> 
[mailto:ironruby-core-boun...@rubyforge.org<mailto:ironruby-core-boun...@rubyforge.org>]
 On Behalf Of Paul Wheeler
Sent: Thursday, March 24, 2011 2:01 PM
To: ironruby-core@rubyforge.org<mailto:ironruby-core@rubyforge.org>
Subject: [Ironruby-core] IronRuby not loading DLL
I have been using IronRuby for a while now to do simple scripting against 
DotNet DLLs with great success. I ran in to a problem recently where I am 
asking IronRuby 1.1.1 to require a DLL but it does not appear to be loaded. I 
do not get an error message but cannot instantiate any types from the DLL. If I 
do "p Object.constants" it does not return any namespaces or classes from the 
DLL.

When trying to do:
"mdMATCHUPOBJECTLib::mdMUIncrementalClass.new"

I get the error:
"undefined method mdMATCHUPOBJECTLib"

Where mdMUIncrementalClass is a class in the DLL and mdMATCHUPOBJECTLib is the 
namespace. This works perfectly in C#/VisualStudio with the same DLL (I am 
basically using the exact same code in C# and Ruby). If it helps, this is an 
Interop DLL created by Visual Studio from a COM DLL.

--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core




_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core


_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org<mailto:Ironruby-core@rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core

_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to