-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util: change in console.log() output #29539
Comments
i don't know if this change is a bug or not, but people really shouldn't ever depend on the output of util.format. its only designed for humans. |
@bnb #21624 is independent from this. It changed in #23162. I am not totally happy with this change as I outlined in the PR. I plan on improving things at some point but it's nothing urgent for me. I have to agree with @devsnek though that it's not ideal to depend on the output of |
If the console.log output changed, I would agree its semver-major, I think its reasonable to depend on the output of
Am I missing something, @bnb? Did you mistype the version? |
I would only call it semver-major if |
In the browser, that's true, and some use it like that in node.js, which is very reasonable, but others use it as "node's printf", it even support prinf-like formats. If I write a reporting tool that does But like it or not that people should depend on it, the definition of a breaking change is a change that breaks previously running code.There are things that are much more subtle changes in the API, like event ordering, or whether internal, undocumented properties as exposed or not, that we have treated as semver-major, I'd say |
perhaps we need better documentation, but you should be using stuff like |
Well, that surprises me, and I'm not sure I agree with it. An API with stable output only for certain arg combinations seems a bit cranky, and I'm not seeing any docs distinguishing when a user can and can't depend on the output. All the call patterns seem equally allowed, that some are not equally stable seems worrisome. Anyhow, at this point, I can't reproduce the bug, and I haven't heard lots of complaints about unstable output, so maybe there is no problem here. However, the "some console.log arg combinations are more equal than others in terms of stability" argument makes me more concerned than comforted. |
I'm able to reproduce locally on when comparing Node.js v8.x with Node.js v12.x, @devsnek. Spent some time trying to track down the origin of the actual change since it was obscured by a bunch of layers of indirection. Apologies for the incorrect reference @BridgeAR – did the best I could 😅 On relying on |
Fwiw, I’m surprised by this change myself – I always thought that when the first argument was not a string, every argument would be I also don’t see any disadvantage in marking changes like this as semver-major, if we are convinced that they should happen. It might be a bit annoying for backporting, but the ability of our users to rely on stable results should come first, imo. |
That was before my change yes. The string-first case actually ended up in the code othat was doing printf token replacements so that's why it's formatting differed from the others. I don't think that behaviour was ever intended to be that way. The change appeared in v12.0.0 and is documented on
Voting to close this. |
I personally think the old behavior is better than the current one and I would rather revert to that. |
If this didn't show up in an 8.x minor, but in 12.0.0 as @silverwind says, then its an allowed breaking change. If we don't like it, then it can be reverted in 13.x if someone is fast. 12.x is stuck with the behaviour, though, for stability. I like the old behaviour better, I think, but I haven't seen the conversation that led to the change, maybe there was good reason. All of which is tangential to this particular bug report, though. |
I prefer consistency. Either format all or no arguments, regardless of argument count or type. Format all is probably too much of a breaking change if |
+1 to reverting to the original behavior, regardless of the merits of the change, it's a semver-major difference and shouldn't have gone into 12.x |
It was done in 12.0.0, that by definition is a |
The original issue says:
But that is not accurate, the change did not ship, at all, in any 10.x release: I tested 10.7, 10.8 -- the one claimed -- and 10.16.3, none have this change. @bnb wrote
That comment could be misread as a statement that a major landed inappropriately breaking a release line (though I don't think that was the intention). As @silverwind says, we can land I can't reproduce anything that shows a break of nodejs' stability commitments. However, many comments above indicate the change is not desireable. Should we edit the description so it is accurate? Or close this and open a new issue requesting the change be reverted in the next semver-major, 13.x? |
This is actually correct, if a bit annoying. |
This reverts nodejs#23162. The gained consistency did not outweight the benefit of inspecting the arguments. Therefore it is best to revert to the former behavior. Refs: nodejs#29539 Refs: nodejs#23162
I don't think there's anything actionable at this point in time. Closing. Can reopen if necessary |
In v10.8.0, #21624 shipped.
This is seemingly a semver major change, despite having shipped in a semver minor release.What's the change?
The result of:
changed from:
to:
Here's an example in the repl:
This was surfaced to me by @euantorano from their issue in Nim, in which their tests failed because they were built to expect the old behavior: nim-lang/Nim#12182 (comment)
The text was updated successfully, but these errors were encountered: