-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Description
Hi Node.js community
I did some work recently in response to a bug filed about Symbol.toStringTag not being used if a class inherited a null prototype (https://chromium-review.googlesource.com/c/v8/v8/+/820292) (of course, in reality Symbol.toStringTag wasn't used at all in the case the bug mentioned, due to being an accessor property, but still!)
This CL would take the "render-constructor-name" path in more (most) cases, whether the stringified object is not a function, and isn't an Error or doesn't have the same toString method as error, and doesn't have a usable Symbol.toStringTag data property.
Making this change results in some other effects, for instance Proxies no longer look like [object Object], but instead tend to render as #Proxy.
I also feel that it would be helpful for developers to report more information for proxies, for instance also providing some information about the target object. However, this is a bit of an information leak, and makes "membranes" a little bit invisible. This isn't done in the current CL, but maybe it's something that would be worth tacking on. Something like #Proxy<MyFancyFrameworkClass> or something?
So, I wanted to get some feedback from Node-core (and Node users) before landing any of these changes upstream. What would you think about making Proxy objects more clearly Proxies? How much pain would the rest of the CL cause in general, with respect to rendering the constructor-derived string (Are people doing weird things like parsing error messages or something?)