whatwg / console

Console Standard
https://console.spec.whatwg.org/
Other
269 stars 67 forks source link

Changes in Logger() definition #231

Open jimmonte opened 9 months ago

jimmonte commented 9 months ago

What is the issue with the Console Standard?

The returned value types of the three return points of Logger() at https://console.spec.whatwg.org/#logger are not consistent but should be. Further, since Formatter(x) returns x when the size of x is one, steps 2, 3, and 4 can be eliminated.

domfarolino commented 9 months ago

It does seem that Logger() doesn't need to return anything. The note below Logger() mentioning that the return value matters for consoles that tend to print return values of functions doesn't really apply here, since the return value of Logger() is never used anywhere, and that's more of a function of what the Web IDL says the return value is and how browsers treat that, vs what Logger() specifically returns.

I don't understand your second point about Formatter(x).

domfarolino commented 9 months ago

Pull requests are welcome.

jimmonte commented 9 months ago

@domfarolino

It does seem that Logger() doesn't need to return anything.

Whatever it returns, even if it is nothing, should be the same at all of its return points.

I don't understand your second point about Formatter(x).

There is no need for a separate case to print a single object since calling Formatter() with that object will return that object. So the definition can be simplified by combining the cases.