Possibility of standardized sprintf() in ES4?
Brendan Eich
brendan at mozilla.org
Sat Oct 27 11:27:26 PDT 2007
On Oct 27, 2007, at 11:06 AM, Dan Scott wrote:
> Just following up on the discussion - since I've seen an
> announcement that the spec for ES4 is now closed, does this mean
> that a proposal for an addition of a standardized sprintf / format
> addition to the String object is off the table until ES5? Or have
> the Ecma members of the group decided that there is no actual
> requirement for this functionality?
See http://wiki.ecmascript.org/doku.php?
id=discussion:string_formatting and also http://wiki.ecmascript.org/
doku.php?id=meetings:minutes_feb_24_2006&s=string+formatting, which
contains:
# String formatting choices:
* Leave out, defer to the emergent standard library ecology?
Then lose type system tie-in opportunites.
* .NET vs. MSCOM vs. Java vs. others leaves no single obvious
choice of what to imitate.
* OCaml, other precedents? Roll-our-own function-combinatorial
typed formatting? Too inconvenient.
* Ed points out that strings imply localization, more worms.
These considerations suggested to us that we defer this to the
library ecosystem. But we could have missed an opportunity here.
> Beyond raising this issue on the mailing list and finding some
> support in principle for the proposal, if not for the actual form
> of the proposal, I'm not sure what the next step is supposed to be.
> It does seem like a major functionality gap in the language, to me,
> but I'm only one small voice.
In your view, is it a gap in the standard library, a gap to fill by
competing libraries before anything is standardized, or truly a gap
in the core language? For there to be a gap in the core language, it
seems to me the proposal must involve static type checking of actual
arguments against format specifiers. Otherwise, as Lars noted in the
discussion page, even ES3 has enough reflection to build a
dynamically type-safe formatter as library code. Successful Ajax
libraries have built such things.
/be
More information about the Es4-discuss
mailing list