# Code Review: MutableStringCenter

**URL:** <https://www.ruby-forum.com/t/code-review-mutablestringcenter/141668>\
**Category:** IronRuby\
**Created:** [June 28, 2008, 11:21pm UTC](https://www.ruby-forum.com/t/code-review-mutablestringcenter/141668 "2008-06-28T23:21:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave\_Remy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9fc29f/32.png) [@Dave\_Remy](https://www.ruby-forum.com/u/Dave_Remy)\
**Post date:** [June 28, 2008, 11:21pm UTC](https://www.ruby-forum.com/t/code-review-mutablestringcenter/141668/1 "2008-06-28T23:21:15Z")

</div>

tfpt review “/shelveset:MutableStringCenter;REDMOND\dremy”  
Comment :  
Made changes for MutableString.center to pass specs. Included flowing  
taint correctly, subclassing, changing signature to use object and then  
doing manual conversion.

---

<div class="post-metadata">

**Author:** ![Dave\_Remy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9fc29f/32.png) [@Dave\_Remy](https://www.ruby-forum.com/u/Dave_Remy)\
**Post date:** [June 30, 2008, 1:31am UTC](https://www.ruby-forum.com/t/code-review-mutablestringcenter/141668/2 "2008-06-30T01:31:58Z")

</div>

I know that at some point, we were always defining multiple overloads in  
cases like this. For center, I would have probably included both the  
old signature and the new one:

Center(CodeContext, MutableString, int len, [Optional]MutableString  
padding);  
Center(CodeContext, MutableString, object len, [Optional]object pad);

…and simply had the more general version do it’s protocol-based  
conversions and then call the more specific implementation. But I don’t  
know if that’s still the convention we’re following for the libraries.

---

<div class="post-metadata">

**Author:** ![Dave\_Remy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9fc29f/32.png) [@Dave\_Remy](https://www.ruby-forum.com/u/Dave_Remy)\
**Post date:** [June 30, 2008, 4:39pm UTC](https://www.ruby-forum.com/t/code-review-mutablestringcenter/141668/3 "2008-06-30T16:39:48Z")

</div>

There’s an overload for FlowTaint() that will accept two from args. If  
either self _or_ padding is tainted the result is tainted, and that’s  
what that form of FlowTaint() will do.

Thanks,  
-John
