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 ) "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 Maccari -------------------------------- http://testdrivendevelopment.wordpress.com/ http://twitter.com/scott4dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100506/9c56837a/attachment.html>
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 Carrero Web: http://whiterabbitconsulting.eu - http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Microsoft IronRuby/C# MVP On Thu, May 6, 2010 at 8:38 AM, Claudio Maccari <claudio.maccari at gmail.com>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) > "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 Maccari > -------------------------------- > http://testdrivendevelopment.wordpress.com/ > http://twitter.com/scott4dev > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100506/2e0bbd4e/attachment.html>
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 Friedman | Microsoft Visual C#/IronRuby MVP | Author of IronRuby Unleashed Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay On Thu, May 6, 2010 at 9:48 AM, Ivan Porto Carrero <ivan at cloudslide.net>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 Carrero > Web: http://whiterabbitconsulting.eu - http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > Microsoft IronRuby/C# MVP > > > On Thu, May 6, 2010 at 8:38 AM, Claudio Maccari <claudio.maccari at gmail.com > > 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) >> "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 Maccari >> -------------------------------- >> http://testdrivendevelopment.wordpress.com/ >> http://twitter.com/scott4dev >> >> _______________________________________________ >> 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 > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100506/5c082d4b/attachment.html>
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 Carrero <ivan at cloudslide.net>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 Carrero > Web: http://whiterabbitconsulting.eu - http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > Microsoft IronRuby/C# MVP > > > On Thu, May 6, 2010 at 8:38 AM, Claudio Maccari <claudio.maccari at gmail.com > > 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) >> "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 Maccari >> -------------------------------- >> http://testdrivendevelopment.wordpress.com/ >> http://twitter.com/scott4dev >> >> _______________________________________________ >> 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 > >-- Claudio Maccari -------------------------------- http://testdrivendevelopment.wordpress.com/ http://twitter.com/scott4dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100506/661ab483/attachment-0001.html>
But this assembly has no types inside right ? On Thu, May 6, 2010 at 8:55 AM, Shay Friedman <shay.friedman at gmail.com>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 Friedman | Microsoft Visual C#/IronRuby MVP | Author of IronRuby > Unleashed > Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay > > > On Thu, May 6, 2010 at 9:48 AM, Ivan Porto Carrero <ivan at cloudslide.net>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 Carrero >> Web: http://whiterabbitconsulting.eu - http://flanders.co.nz >> Twitter: http://twitter.com/casualjim >> Author of IronRuby in Action (http://manning.com/carrero) >> Microsoft IronRuby/C# MVP >> >> >> On Thu, May 6, 2010 at 8:38 AM, Claudio Maccari < >> claudio.maccari at gmail.com> 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) >>> "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 Maccari >>> -------------------------------- >>> http://testdrivendevelopment.wordpress.com/ >>> http://twitter.com/scott4dev >>> >>> _______________________________________________ >>> 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 > >-- Claudio Maccari -------------------------------- http://testdrivendevelopment.wordpress.com/ http://twitter.com/scott4dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100506/28c08d9a/attachment.html>
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 Friedman | Microsoft Visual C#/IronRuby MVP | Author of IronRuby Unleashed Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay On Thu, May 6, 2010 at 10:36 AM, Claudio Maccari <claudio.maccari at gmail.com>wrote:> But this assembly has no types inside right ? > > > On Thu, May 6, 2010 at 8:55 AM, Shay Friedman <shay.friedman at gmail.com>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 Friedman | Microsoft Visual C#/IronRuby MVP | Author of IronRuby >> Unleashed >> Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay >> >> >> On Thu, May 6, 2010 at 9:48 AM, Ivan Porto Carrero <ivan at cloudslide.net>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 Carrero >>> Web: http://whiterabbitconsulting.eu - http://flanders.co.nz >>> Twitter: http://twitter.com/casualjim >>> Author of IronRuby in Action (http://manning.com/carrero) >>> Microsoft IronRuby/C# MVP >>> >>> >>> On Thu, May 6, 2010 at 8:38 AM, Claudio Maccari < >>> claudio.maccari at gmail.com> 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) >>>> "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 Maccari >>>> -------------------------------- >>>> http://testdrivendevelopment.wordpress.com/ >>>> http://twitter.com/scott4dev >>>> >>>> _______________________________________________ >>>> 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 >> >> > > > -- > Claudio Maccari > -------------------------------- > http://testdrivendevelopment.wordpress.com/ > http://twitter.com/scott4dev > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100506/46bb1868/attachment.html>
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 Carrero Web: http://whiterabbitconsulting.eu - http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Microsoft IronRuby/C# MVP On Thu, May 6, 2010 at 9:21 AM, Claudio Maccari <claudio.maccari at gmail.com>wrote:> 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 Carrero <ivan at cloudslide.net>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 Carrero >> Web: http://whiterabbitconsulting.eu - http://flanders.co.nz >> Twitter: http://twitter.com/casualjim >> Author of IronRuby in Action (http://manning.com/carrero) >> Microsoft IronRuby/C# MVP >> >> >> On Thu, May 6, 2010 at 8:38 AM, Claudio Maccari < >> claudio.maccari at gmail.com> 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) >>> "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 Maccari >>> -------------------------------- >>> http://testdrivendevelopment.wordpress.com/ >>> http://twitter.com/scott4dev >>> >>> _______________________________________________ >>> 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 >> >> > > > -- > Claudio Maccari > -------------------------------- > http://testdrivendevelopment.wordpress.com/ > http://twitter.com/scott4dev > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100506/410245b4/attachment-0001.html>
The aliasing doesn''t work or I missed something :( On Thu, May 6, 2010 at 12:50 PM, Ivan Porto Carrero <ivan at cloudslide.net>wrote:> 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 Carrero > Web: http://whiterabbitconsulting.eu - http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > Microsoft IronRuby/C# MVP > > > On Thu, May 6, 2010 at 9:21 AM, Claudio Maccari <claudio.maccari at gmail.com > > wrote: > >> 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 Carrero <ivan at cloudslide.net>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 Carrero >>> Web: http://whiterabbitconsulting.eu - http://flanders.co.nz >>> Twitter: http://twitter.com/casualjim >>> Author of IronRuby in Action (http://manning.com/carrero) >>> Microsoft IronRuby/C# MVP >>> >>> >>> On Thu, May 6, 2010 at 8:38 AM, Claudio Maccari < >>> claudio.maccari at gmail.com> 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) >>>> "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 Maccari >>>> -------------------------------- >>>> http://testdrivendevelopment.wordpress.com/ >>>> http://twitter.com/scott4dev >>>> >>>> _______________________________________________ >>>> 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 >>> >>> >> >> >> -- >> Claudio Maccari >> -------------------------------- >> http://testdrivendevelopment.wordpress.com/ >> http://twitter.com/scott4dev >> >> _______________________________________________ >> 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 > >-- Claudio Maccari -------------------------------- http://testdrivendevelopment.wordpress.com/ http://twitter.com/scott4dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100506/75f7e854/attachment.html>
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 Maccari <claudio.maccari at gmail.com>wrote:> The aliasing doesn''t work or I missed something :( > > > On Thu, May 6, 2010 at 12:50 PM, Ivan Porto Carrero <ivan at cloudslide.net>wrote: > >> 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 Carrero >> Web: http://whiterabbitconsulting.eu - http://flanders.co.nz >> Twitter: http://twitter.com/casualjim >> Author of IronRuby in Action (http://manning.com/carrero) >> Microsoft IronRuby/C# MVP >> >> >> On Thu, May 6, 2010 at 9:21 AM, Claudio Maccari < >> claudio.maccari at gmail.com> wrote: >> >>> 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 Carrero <ivan at cloudslide.net>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 Carrero >>>> Web: http://whiterabbitconsulting.eu - http://flanders.co.nz >>>> Twitter: http://twitter.com/casualjim >>>> Author of IronRuby in Action (http://manning.com/carrero) >>>> Microsoft IronRuby/C# MVP >>>> >>>> >>>> On Thu, May 6, 2010 at 8:38 AM, Claudio Maccari < >>>> claudio.maccari at gmail.com> 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) >>>>> "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 Maccari >>>>> -------------------------------- >>>>> http://testdrivendevelopment.wordpress.com/ >>>>> http://twitter.com/scott4dev >>>>> >>>>> _______________________________________________ >>>>> 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 >>>> >>>> >>> >>> >>> -- >>> Claudio Maccari >>> -------------------------------- >>> http://testdrivendevelopment.wordpress.com/ >>> http://twitter.com/scott4dev >>> >>> _______________________________________________ >>> 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 >> >> > > > -- > Claudio Maccari > -------------------------------- > http://testdrivendevelopment.wordpress.com/ > http://twitter.com/scott4dev >-- Claudio Maccari -------------------------------- http://testdrivendevelopment.wordpress.com/ http://twitter.com/scott4dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100506/04baedcc/attachment-0001.html>
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: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Claudio Maccari Sent: Thursday, May 06, 2010 12:22 AM To: ironruby-core at rubyforge.org 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 Carrero <ivan at cloudslide.net<mailto:ivan at cloudslide.net>> 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 Carrero Web: http://whiterabbitconsulting.eu - http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Microsoft IronRuby/C# MVP On Thu, May 6, 2010 at 8:38 AM, Claudio Maccari <claudio.maccari at gmail.com<mailto:claudio.maccari at gmail.com>> 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) "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 Maccari -------------------------------- http://testdrivendevelopment.wordpress.com/ http://twitter.com/scott4dev _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core -- Claudio Maccari -------------------------------- http://testdrivendevelopment.wordpress.com/ http://twitter.com/scott4dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100506/73a2758d/attachment.html>
This won''t work since C# aliases are available only at compile time. They are not persisted in the resulting assembly. Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Claudio Maccari Sent: Thursday, May 06, 2010 12:36 AM To: ironruby-core at rubyforge.org 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 Friedman <shay.friedman at gmail.com<mailto:shay.friedman at gmail.com>> 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 Friedman | Microsoft Visual C#/IronRuby MVP | Author of IronRuby Unleashed Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay On Thu, May 6, 2010 at 9:48 AM, Ivan Porto Carrero <ivan at cloudslide.net<mailto:ivan at cloudslide.net>> 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 Carrero Web: http://whiterabbitconsulting.eu - http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Microsoft IronRuby/C# MVP On Thu, May 6, 2010 at 8:38 AM, Claudio Maccari <claudio.maccari at gmail.com<mailto:claudio.maccari at gmail.com>> 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) "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 Maccari -------------------------------- http://testdrivendevelopment.wordpress.com/ http://twitter.com/scott4dev _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core -- Claudio Maccari -------------------------------- http://testdrivendevelopment.wordpress.com/ http://twitter.com/scott4dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100506/841607fe/attachment-0001.html>
Amazing, now it works! :) Thank you very much Tomas!!! Bye Claudio On Thu, May 6, 2010 at 6:31 PM, Tomas Matousek <Tomas.Matousek at microsoft.com> wrote:> 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:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Claudio Maccari > *Sent:* Thursday, May 06, 2010 12:22 AM > *To:* ironruby-core at rubyforge.org > *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 Carrero <ivan at cloudslide.net> > 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 Carrero > Web: http://whiterabbitconsulting.eu - http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > Microsoft IronRuby/C# MVP > > On Thu, May 6, 2010 at 8:38 AM, Claudio Maccari <claudio.maccari at gmail.com> > 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) > > "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 Maccari > -------------------------------- > http://testdrivendevelopment.wordpress.com/ > http://twitter.com/scott4dev > > > > _______________________________________________ > 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 > > > > > -- > Claudio Maccari > -------------------------------- > http://testdrivendevelopment.wordpress.com/ > http://twitter.com/scott4dev > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-- Claudio Maccari -------------------------------- http://testdrivendevelopment.wordpress.com/ http://twitter.com/scott4dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100508/929ef82d/attachment-0001.html>