[Ironruby-core] Handling C# lower case namespaces

Michael Letterle michael.letterle at gmail.com
Fri Dec 5 16:57:59 EST 2008


Just monkey-patch it:

class System::Int64

     def inspect
          self.to_string.to_s
     end
end

;)



On Fri, Dec 5, 2008 at 4:50 PM, Tomas Matousek <Tomas.Matousek at microsoft.com
> wrote:

>  Well, that's very unfortunate. They seems to break .NET guidelines for
> namespace naming. It's not compatible with Ruby language to have lowercased
> namespaces since they behave like modules. Module names must start with an
> upper case. We can add some API to overcome this, but it won't be pretty.
> Something like
>
>
>
> clr.class_get :foo, :bar, :baz would return class for type foo.bar.baz.
>
>
>
> For now you can use reflection API to get the type (and Ruby class for that
> type):
>
> System::Type.get_type("foo.bar.baz").to_class
>
>
>
> As for Int64… it prints #<System::Int64:0x000005e>, which is not
> particularly useful. It should probably call ToString. I'll file a bug.
>
>
>
> Tomas
>
>
>
> *From:* ironruby-core-bounces at rubyforge.org [mailto:
> ironruby-core-bounces at rubyforge.org] *On Behalf Of *Aaron Feng
> *Sent:* Friday, December 05, 2008 1:07 PM
> *To:* ironruby-core at rubyforge.org
> *Subject:* [Ironruby-core] Handling C# lower case namespaces
>
>
>
> It seems like the current version does not handle lower case namespaces
> when referencing a .NET DLL.  It thinks it is a method call whenever a
> constant starts with lower case.  It also doesn't handle non-alphabet
> characters such as _ (underscore).
>
> I'm trying to call WCF service from IronRuby via the proxies file.  svcutil
> converts all namespaces in the proxies file to lower case.  Here's some info
> on it:
>
>
> http://connect.microsoft.com/wcf/feedback/ViewFeedback.aspx?FeedbackID=298408
>
> I also noticed that "puts" does not output the value of Int64.  However, it
> does if I use Console.WriteLine in my ruby program.
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>


-- 
Michael Letterle
[Polymath Prokrammer]
http://blog.prokrams.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20081205/8a9516f6/attachment.html>


More information about the Ironruby-core mailing list