-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Possibly unnecessary code? #4581
Comments
It was probably done for convenience. By binding the methods to instance, they can easily be passed as callbacks: fs.stat('foo.txt', console.log);
Promise.resolve('foo').then(console.log) |
@targos But that's not how browsers do it though. Is the convenience and probably some kind of perf hit worth the disparate semantics from browserland? |
With all the isomorphic javascript projects showing up, Also, it exists in node as |
There's a ton of code using console.log statically in the Node.js ecosystem. Not worth breaking. I think browsers should change instead. Though, that's better discussed here: whatwg/console#3 |
I don't think browsers should change (since it changes Closing. |
While reading the
lib/console.js
source to triage another issue, I noticed that I didn't understand the need for these lines of code. What is the rationale behind binding prototype methods to the newthis
and then sticking 'em on the new object being created?The only places removing these lines has an affect is in:
parallel/test-console-instance.js
where on line 58 we can just change it toc.log.bind(c)
to fix the testTickProcessor.printStatistics
definition which is eval-d as a part of thetest-tick-processor.js
testI tried to pin point what the issue was but I wasn't able to use
require
,console
, etc inv8_prof_processor.js
which is called as a part of thetest-tick-processor.js
test and that left me kind of handicapped.The text was updated successfully, but these errors were encountered: