It is ok for a give format specifier to apply to multiple type of object. In
your example, 'x' is applied to an array of numbers. But the language
interpreter should not do a hidden conversion to make it applicable.  For
example, "{0:x}".("48")  should throw an exception instead of trying to do 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().
> >>
> >
> > If the format specifier does not apply to the argument given, it should
> > raise exceptions. Except string conversion, no other conversion will be
> > done.
>
> Disagree.  Since ECMAScript knows the type of the arguments, it does _not_
> need the format specifier to tell it the type (as C does).  Apparent
> mismatches should be left open as extensions.  For example, the `x`
> formatter should simply specify that numeric values should be expressed in
> base 16, not that the value _must_ be a number.  That way, you could pass an
> Array of numbers to `x` and see the numbers in base 16.
>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to