I'm wondering about the depth option for util.inspect.
The documentation states "_To make it recurse indefinitely, pass null._"
I think it would be more intuitive to pass Infinity to make it recurse indefinitely.
Would a change like this be accepted?
A documentation update like that would indeed be welcome. It should still say that null is supported though.
@BridgeAR Should the code be updated, too? For example, should the default options be changed? https://github.com/nodejs/node/blob/2b8512738aa14bfa157f010eee198c123b4d8b14/lib/util.js#L81-L83
Haven't looked into it too deeply yet, but I suspect there might be other places that probably should be updated, too.
Personal opinion, while we still need to support null for backwards compatibility, it does send the wrong message, and I believe we should use Infinity over null for signifying Infinite depth.
Looking at the current doc on master looks like this was already done, it also changes depth default from 2 to Infinity
馃憤

Second time contributor here. Sorry I missed that.
Seems like that change was already done as part of https://github.com/nodejs/node/pull/17907, which is a semver major change (if I understood correctly, because the default depth was changed from 2 to Infinity) that didn't make it into v10.0.0, but is now in master.
Do you still think it's a good idea to just change the docs and change the internal implementation so it is a non-breaking change (more or less, if (depth === null) depth = Infinity;), without changing the default depth? I think, if that is done first in a patch release now, it could prepare people for the upcoming semver-major change. :)
@MarkTiedemann
I think, if that is done first in a patch release now, it could prepare people for the upcoming semver-major change.
It is already possible to do that right now and there should not be any difference for a user if that is documented or not. I suggest to target 10.x to update the docs there.
Seems like that change was already done as part of #17907
That is correct and it is currently unclear if that will be reverted or not. It is definitely going to get _a_ change, how ever that will look like.
Closing this as the current documentation already mentions Infinity.
Most helpful comment
Looking at the current doc on master looks like this was already done, it also changes

depthdefault from 2 to Infinity馃憤