On Tue, Mar 3, 2009 at 9:46 PM, Thibaut Barrère
<[email protected]>wrote:

> Hi,
>
> while writing specs for Magic, I noticed that:
>
> instance_from(MenuItem, "Hello").text.*to_s*.should == "Hello"
>
> to_s is required to get the assertion to pass. The following will return
> false:
>
> button = Button.new
> button.text = "Hello"
> puts button.text == "Hello"
>
> So I guess that CLR strings cannot be compared to Ruby strings unless to_s
> is applied.
>

I have stumbled on this too and was very surprised. This problem does not
exist in IronPython (does it? please correct me if I am wrong). The behavior
I was expecting is that "on the ruby" side all strings are (or at least
behave exactly like) ruby strings, even if they come from .NET and are
automatically converted to clr-strings when passed into clr methods.

cheers,
-- henon
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to