Re: A proposal to add String.prototype.format

2011-03-09 Thread Shanjian Li
to and it doesn't seem to claim to. Is that right Shanjian? Is there nothing that mitigates quoting confusion in this proposal? On Wed, Mar 9, 2011 at 12:21 AM, Shanjian Li shanj...@google.com wrote: EcmaScript lacks a method to format strings in a flexible and controllable manner. Most EcmaScript

Re: A proposal to add String.prototype.format

2011-03-09 Thread Shanjian Li
Comment inline. On Wed, Mar 9, 2011 at 12:37 AM, Lasse Reichstein reichsteinatw...@gmail.com wrote: On Wed, 09 Mar 2011 01:21:09 +0100, Shanjian Li shanj...@google.com wrote: http://wiki.ecmascript.org/doku.php?id=strawman:string_format_take_two Please kindly review the proposal and let

Re: A proposal to add String.prototype.format

2011-03-09 Thread Shanjian Li
a hidden toNumber(). shanjian On Wed, Mar 9, 2011 at 10:48 AM, P T Withington p...@pobox.com wrote: On 2011-03-09, at 13:20, Shanjian Li wrote: It doesn't specify how to print objects, except for %s, which says that if the argument is not a string, convert it to string using .toString

Re: A proposal to add String.prototype.format

2011-03-09 Thread Shanjian Li
I like this idea. I thought a lot about how to support those locale specific stuff like plural and gender. Your suggestion provide an elegant way to transfer the responsibility to a more appropriate party. shanjian On Wed, Mar 9, 2011 at 1:18 PM, Bob Nystrom rnyst...@google.com wrote: It

Re: A proposal to add String.prototype.format

2011-03-09 Thread Shanjian Li
) Also, it doesn't require mundane fixes later on and keeps things simple for the developer. (No needed knowledge or maintenance of things based on position.) On Wed, Mar 9, 2011 at 15:36, Shanjian Li shanj...@google.com wrote: I like this idea. I thought a lot about how to support those

A proposal to add String.prototype.format

2011-03-08 Thread Shanjian Li
EcmaScript lacks a method to format strings in a flexible and controllable manner. Most EcmaScript strings are constructed by concatenating a series of substrings. Such practice really hurts code readability. Especially for localization, it is almost impossible to translate the string when it is