console icon indicating copy to clipboard operation
console copied to clipboard

Reference implementation of the %s format specifier should call String

Open fmartin5 opened this issue 6 years ago • 1 comments

In the reference implementation for format specifiers, the %s format specifier is implemented using implicit string coercion and the addition operator:

https://github.com/whatwg/console/blob/88179f2f76e62b765294dffe8a68a7570dd30bb8/reference-implementation/Logger.js#L10 Given the corresponding spec:

If specifier is %s, let converted be the result of Call(%String%, undefined, « current »).

I think explicitly calling the String constructor, as a function, would be a more explicit and accurate way to represent the meaning of the spec.

For example:

  '%s': function(a) { return String(a); }, // string

fmartin5 avatar May 28 '18 02:05 fmartin5

I agree, however we're probably going to rip out the reference implementation and some of the NOTES.md section IIRC, I can double check though.

domfarolino avatar May 28 '18 02:05 domfarolino

Seems like this should be closed now?

SamB avatar Dec 04 '22 03:12 SamB

Agreed, thanks.

domfarolino avatar Dec 05 '22 05:12 domfarolino