# Code Review: StringIO and Array.to\_s

**URL:** <https://www.ruby-forum.com/t/code-review-stringio-and-array-to-s/170328>\
**Category:** IronRuby\
**Created:** [June 16, 2009, 1:27am UTC](https://www.ruby-forum.com/t/code-review-stringio-and-array-to-s/170328 "2009-06-16T01:27:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [June 16, 2009, 1:27am UTC](https://www.ruby-forum.com/t/code-review-stringio-and-array-to-s/170328/1 "2009-06-16T01:27:52Z")

</div>

Tim, this bounced … are you registered for the mailing list?  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

From: Tim C. (SDO) [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
Sent: Monday, June 15, 2009 4:23 PM  
To: removed\_email\_address@domain.invalid  
Subject: Code Review: StringIO and Array.to\_s

Modified RecursiveJoin to have an printRecursiveArray option.  
This is needed since StringIO does not print out recursiveArray values  
while array.to\_s does.

For example:

a = [1,2,3]  
a \<\< a  
@io.puts(a) → prints "1\n2\n3\n[…]\n  
a.to\_s → prints “123123[…]”

Fixed all calls to Join to also pass in printRecursiveArray option.

- 

Merlin/Main/Languages/Ruby/Libraries.LCA\_RESTRICTED/Builtins/IoOps.cs[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-0](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-0)  
\*  
Merlin/Main/Languages/Ruby/Libraries.LCA\_RESTRICTED/Extensions/IListOps.cs[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-1](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-1)

[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033)

Thanks!

Tim

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [June 16, 2009, 9:15am UTC](https://www.ruby-forum.com/t/code-review-stringio-and-array-to-s/170328/2 "2009-06-16T09:15:26Z")

</div>

Yes I am,

I just emailed to the wrong email address!

(ironruby-core-bounces instead of ironruby-core)

It was autocompleted by outlook, and I didn’t know which is right.

Thanks!

Tim

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Jimmy  
Schementi  
Sent: Monday, June 15, 2009 4:27 PM  
To: removed\_email\_address@domain.invalid  
Subject: [Ironruby-core] Code Review: StringIO and Array.to\_s

Tim, this bounced … are you registered for the mailing list?  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

From: Tim C. (SDO) [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
Sent: Monday, June 15, 2009 4:23 PM  
To: removed\_email\_address@domain.invalid  
Subject: Code Review: StringIO and Array.to\_s

Modified RecursiveJoin to have an printRecursiveArray option.  
This is needed since StringIO does not print out recursiveArray values  
while array.to\_s does.

For example:

a = [1,2,3]  
a \<\< a  
@io.puts(a) → prints "1\n2\n3\n[…]\n  
a.to\_s → prints “123123[…]”

Fixed all calls to Join to also pass in printRecursiveArray option.

- 

Merlin/Main/Languages/Ruby/Libraries.LCA\_RESTRICTED/Builtins/IoOps.cs[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-0](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-0)  
\*  
Merlin/Main/Languages/Ruby/Libraries.LCA\_RESTRICTED/Extensions/IListOps.cs[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-1](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-1)

[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033)

Thanks!

Tim

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [June 16, 2009, 1:14pm UTC](https://www.ruby-forum.com/t/code-review-stringio-and-array-to-s/170328/3 "2009-06-16T13:14:07Z")

</div>

With IR 0.3 release we have:

c:\work\napa.net\NapaRuby\>\work\tools\ruby\ironruby-0.3.0\bin\ir.exe  
IronRuby 0.3.0.0 on .NET 2.0.50727.3074  
Copyright (c) Microsoft Corporation. All rights reserved.

> > > x=“abc”.to\_clr\_string  
> > > =\> ‘abc’

We can call x.GetType method in “ruby case”:

> > > x.get\_type  
> > > =\> #System::RuntimeType:0x000005c

With a recent codebase from:  
[http://www.codeplex.com/dlr/SourceControl/ListDownloadableCommits.aspx](http://www.codeplex.com/dlr/SourceControl/ListDownloadableCommits.aspx)  
ChangeSet 25140

c:\work\napa.net\NapaRuby\>ir  
IronRuby 0.5.0.0 on .NET 2.0.50727.3074  
Copyright (c) Microsoft Corporation. All rights reserved.

> > > x=System::String.new(‘abc’)  
> > > =\> ‘abc’

> > > x.get\_type  
> > > :0:in ` __send__': undefined method `get\_type’ for “abc”:String  
> > > (NoMethodError)

from C:.…\IronRuby.Libraries\Builtins\KernelOps.cs:1421:in  
`SendMessageOpt’

We can still use the original method name:

> > > x.GetType  
> > > =\> System.String

I suppose the apparent dropping of support for name-mungling is not  
intentional?

Robert J. Brotherus  
Napa Inc.

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [June 17, 2009, 12:27am UTC](https://www.ruby-forum.com/t/code-review-stringio-and-array-to-s/170328/4 "2009-06-17T00:27:01Z")

</div>

Hi Tim, are there existing RubySpecs for the bug? If so, please enable  
the tests by deleting the tags. Else, could you please add to the  
RubySpec specs?

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Tim C. (SDO)  
Sent: Tuesday, June 16, 2009 12:01 AM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] Code Review: StringIO and Array.to\_s

Yes I am,

I just emailed to the wrong email address!

(ironruby-core-bounces instead of ironruby-core)

It was autocompleted by outlook, and I didn’t know which is right.

Thanks!

Tim

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Jimmy  
Schementi  
Sent: Monday, June 15, 2009 4:27 PM  
To: removed\_email\_address@domain.invalid  
Subject: [Ironruby-core] Code Review: StringIO and Array.to\_s

Tim, this bounced … are you registered for the mailing list?  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

From: Tim C. (SDO) [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
Sent: Monday, June 15, 2009 4:23 PM  
To: removed\_email\_address@domain.invalid  
Subject: Code Review: StringIO and Array.to\_s

Modified RecursiveJoin to have an printRecursiveArray option.  
This is needed since StringIO does not print out recursiveArray values  
while array.to\_s does.

For example:

a = [1,2,3]  
a \<\< a  
@io.puts(a) → prints "1\n2\n3\n[…]\n  
a.to\_s → prints “123123[…]”

Fixed all calls to Join to also pass in printRecursiveArray option.

- 

Merlin/Main/Languages/Ruby/Libraries.LCA\_RESTRICTED/Builtins/IoOps.cs[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-0](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-0)  
\*  
Merlin/Main/Languages/Ruby/Libraries.LCA\_RESTRICTED/Extensions/IListOps.cs[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-1](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-1)

[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033)

Thanks!

Tim

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [June 16, 2009, 5:56pm UTC](https://www.ruby-forum.com/t/code-review-stringio-and-array-to-s/170328/5 "2009-06-16T17:56:10Z")

</div>

It is in fact intentional - mangled names are disabled for built-in  
types (Object, Fixnum, String, etc.) since there were problems with name  
conflicts in various Ruby apps.  
The mangling is still on for other CLR types.

Tomas

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [June 17, 2009, 12:46am UTC](https://www.ruby-forum.com/t/code-review-stringio-and-array-to-s/170328/6 "2009-06-17T00:46:54Z")

</div>

I believe he already enabled the spec for Array, and the one for  
StringIO was running before this fix, so there are no tags or tests  
needed.

JD

…there is no try

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shri B.  
Sent: Tuesday, June 16, 2009 3:19 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] Code Review: StringIO and Array.to\_s

Hi Tim, are there existing RubySpecs for the bug? If so, please enable  
the tests by deleting the tags. Else, could you please add to the  
RubySpec specs?

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Tim C. (SDO)  
Sent: Tuesday, June 16, 2009 12:01 AM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] Code Review: StringIO and Array.to\_s

Yes I am,

I just emailed to the wrong email address!

(ironruby-core-bounces instead of ironruby-core)

It was autocompleted by outlook, and I didn’t know which is right.

Thanks!

Tim

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Jimmy  
Schementi  
Sent: Monday, June 15, 2009 4:27 PM  
To: removed\_email\_address@domain.invalid  
Subject: [Ironruby-core] Code Review: StringIO and Array.to\_s

Tim, this bounced … are you registered for the mailing list?  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

From: Tim C. (SDO) [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
Sent: Monday, June 15, 2009 4:23 PM  
To: removed\_email\_address@domain.invalid  
Subject: Code Review: StringIO and Array.to\_s

Modified RecursiveJoin to have an printRecursiveArray option.  
This is needed since StringIO does not print out recursiveArray values  
while array.to\_s does.

For example:

a = [1,2,3]  
a \<\< a  
@io.puts(a) → prints "1\n2\n3\n[…]\n  
a.to\_s → prints “123123[…]”

Fixed all calls to Join to also pass in printRecursiveArray option.

- 

Merlin/Main/Languages/Ruby/Libraries.LCA\_RESTRICTED/Builtins/IoOps.cs[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-0](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-0)  
\*  
Merlin/Main/Languages/Ruby/Libraries.LCA\_RESTRICTED/Extensions/IListOps.cs[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-1](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-1)

[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033)

Thanks!

Tim

---

<div class="post-metadata">

**Author:** ![jsoho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jsoho](https://www.ruby-forum.com/u/jsoho)\
**Post date:** [June 17, 2009, 1:43am UTC](https://www.ruby-forum.com/t/code-review-stringio-and-array-to-s/170328/7 "2009-06-17T01:43:01Z")

</div>

Code changes look good.

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Jim D.  
Sent: Tuesday, June 16, 2009 3:42 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] Code Review: StringIO and Array.to\_s

I believe he already enabled the spec for Array, and the one for  
StringIO was running before this fix, so there are no tags or tests  
needed.

JD

…there is no try

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Shri B.  
Sent: Tuesday, June 16, 2009 3:19 PM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] Code Review: StringIO and Array.to\_s

Hi Tim, are there existing RubySpecs for the bug? If so, please enable  
the tests by deleting the tags. Else, could you please add to the  
RubySpec specs?

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Tim C. (SDO)  
Sent: Tuesday, June 16, 2009 12:01 AM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] Code Review: StringIO and Array.to\_s

Yes I am,

I just emailed to the wrong email address!

(ironruby-core-bounces instead of ironruby-core)

It was autocompleted by outlook, and I didn’t know which is right.

Thanks!

Tim

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Jimmy  
Schementi  
Sent: Monday, June 15, 2009 4:27 PM  
To: removed\_email\_address@domain.invalid  
Subject: [Ironruby-core] Code Review: StringIO and Array.to\_s

Tim, this bounced … are you registered for the mailing list?  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

From: Tim C. (SDO) [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
Sent: Monday, June 15, 2009 4:23 PM  
To: removed\_email\_address@domain.invalid  
Subject: Code Review: StringIO and Array.to\_s

Modified RecursiveJoin to have an printRecursiveArray option.  
This is needed since StringIO does not print out recursiveArray values  
while array.to\_s does.

For example:

a = [1,2,3]  
a \<\< a  
@io.puts(a) → prints "1\n2\n3\n[…]\n  
a.to\_s → prints “123123[…]”

Fixed all calls to Join to also pass in printRecursiveArray option.

- 

Merlin/Main/Languages/Ruby/Libraries.LCA\_RESTRICTED/Builtins/IoOps.cs[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-0](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-0)  
\*  
Merlin/Main/Languages/Ruby/Libraries.LCA\_RESTRICTED/Extensions/IListOps.cs[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-1](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033#diff-1)

[http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033](http://github.com/tnachen/ironruby/commit/759f6007467a0655b2d707f71de1cd5518b65033)

Thanks!

Tim
