Skip to content
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

add undefined type #17011

Closed
wants to merge 1 commit into from
Closed

add undefined type #17011

wants to merge 1 commit into from

Conversation

leeseean
Copy link
Contributor

@leeseean leeseean commented Nov 14, 2017

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

add undefined type

@nodejs-github-bot nodejs-github-bot added the http Issues or PRs related to the http subsystem. label Nov 14, 2017
@bnoordhuis
Copy link
Member

The commit log should explain what and, importantly, why.

@fhinkel
Copy link
Member

fhinkel commented Nov 14, 2017

@leeseean Thanks so much for your first contribution 🎉 . Looks good to me. Could we change to commit message to something like this?

lib: explicitly check for undefined and null

Instead of checking whether the variable is equal (==) to null, 
check whether the value is (===) null or undefined. Explicit
checks are more precise.

The Contributing.md doc describes how to update a commit message:

$ git commit --amend 
// Make changes to the message and save the file
$ git push --force-with-lease origin master

@mscdex mscdex mentioned this pull request Nov 14, 2017
4 tasks
apapirovski
apapirovski previously approved these changes Nov 14, 2017
Copy link
Member

@apapirovski apapirovski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the commit message improved

@bnoordhuis
Copy link
Member

$ git grep -E ' [!=]= (null|undefined)' lib/ | wc -l
59

That is, we have these checks all over the place. It feels a bit haphazard to update them in just two places.

If I'm being honest, I don't think it's very useful. Replacing == with two === is like saying the same thing but with more words. It's really just restating yourself.

(See what I did there?)

@apapirovski apapirovski dismissed their stale review November 20, 2017 14:48

(Wasn't particularly in favour in the first place and since the consensus is against it...)

@BridgeAR
Copy link
Member

If anyone is strongly against landing it, please speak up. Otherwise I am going to land this even though I personally agree that in this case there is not much benefit of changing it.

@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 10, 2017
@apapirovski
Copy link
Member

apapirovski commented Dec 10, 2017

I'm pretty -1 on this after having this sit for a while. There's no point to this change given that neither of these values takes an Object (and if someone passes an Object, it throws anyway, making performance irrelevant). The only reason to not use != null is document.all.

I might make it explicit if this is actually being considered to land and a CI gets started.

@BridgeAR
Copy link
Member

@apapirovski I meant to land it, otherwise I would not have mentioned it. Your condition makes your "soft" -1 actually a "hard" one because it is not possible to land this in that case. How shall we progress here?

@BridgeAR BridgeAR removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 12, 2017
@apapirovski
Copy link
Member

apapirovski commented Dec 12, 2017

@BridgeAR there is no CI at the moment so I don't know if there's intent to land it or not. I just don't see the benefit to this change in this particular part of the code. We have areas where making this change would be beneficial but not here.

Anyway, I won't block it... it's not worth wasting everyone's time with it.

@BridgeAR
Copy link
Member

Mini-CI (enough to test this change): https://ci.nodejs.org/job/node-test-commit-light/147/

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 19, 2018
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Jan 21, 2018
PR-URL: nodejs#17011
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
@BridgeAR
Copy link
Member

Landed in 5164a12

@leeseean congratulations on your first commit to Node.js! 🎉

I fixed the commit message while landing.

@BridgeAR BridgeAR closed this Jan 21, 2018
evanlucas pushed a commit that referenced this pull request Jan 30, 2018
PR-URL: #17011
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
evanlucas pushed a commit that referenced this pull request Jan 30, 2018
PR-URL: #17011
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
@MylesBorins
Copy link
Contributor

Do we want to land this on LTS or is it potentially a behavior change?

MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
PR-URL: nodejs#17011
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants