GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lib: use const to define constants by cjihrig · Pull Request #541 · nodejs/node

Conversation

@cjihrig

@cjihrig cjihrig commented Jan 21, 2015

Copy link
Copy Markdown
Contributor

This commit replaces a number of var statements throughout the lib code with const statements.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cjihrig
lib: use const to define constants
b27f1ba
This commit replaces a number of var statements throughout
the lib code with const statements.
@vkurchatkin

vkurchatkin commented Jan 21, 2015

Copy link
Copy Markdown
Contributor

@cjihrig do you think const should be used instead of var whenever possible? also, what about let?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Jan 21, 2015

Copy link
Copy Markdown
Contributor Author

@vkurchatkin I would be in favor of using const in more places, as well as using let, but that would amount to nearly a full rewrite of all var statements, and a very noisy diff. I tried to hit mostly major items like require() statements and real constants with this commit. I think in the future we could just update the var statements as relevant code is changed. Make sense?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis

bnoordhuis commented Jan 21, 2015

Copy link
Copy Markdown
Member

Rubber-stamp LGTM assuming the CI is happy.

I personally wouldn't object to a PR that let/const-ifies all the things, noisy though it may be. I'm sure it will shake out a few bugs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@wavded

wavded commented Jan 21, 2015

Copy link
Copy Markdown
Contributor

Just to throw this in the mix, it may be worth running some benchmarks on this change. We had some code that utilized const a bit back that a caused us a slow down, when we set it back to var it was fine. All that said, things may be fine now (was about a year or so ago).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis

bnoordhuis commented Jan 21, 2015

Copy link
Copy Markdown
Member

@wavded I checked that earlier this week for another PR. I'm reasonably sure that using const and let should be fine now as long as you stick to strict mode.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Jan 21, 2015

Copy link
Copy Markdown
Contributor Author

@bnoordhuis what's your take on the CI? There is some red, but it seems to be on things that have fluctuated in recent builds.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@wavded

wavded commented Jan 21, 2015

Copy link
Copy Markdown
Contributor

good to know, thx @bnoordhuis

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rvagg

rvagg commented Jan 21, 2015

Copy link
Copy Markdown
Member

@cjihrig: re CI: there's only one or two persistently failing tests, I can't name them off the top of my head. You should ignore FreeBSD for now, that's still WIP and the Windows MSVS 2015 one can be ignored too and will be removed shortly. The other ones are important to pay attention to.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Jan 21, 2015

Copy link
Copy Markdown
Contributor Author

@rvagg Ignoring FreeBSD and Windows MSVS 2015, that leaves test-vm-timeout failing on Ubuntu. It appears to have failed as recently as two builds ago.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis

bnoordhuis commented Jan 21, 2015

Copy link
Copy Markdown
Member

@cjihrig This PR is good to go. The parallel/test-vm-timeout failure is unrelated.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cjihrig added a commit that referenced this pull request Jan 21, 2015
@cjihrig
lib: use const to define constants
804e7aa
This commit replaces a number of var statements throughout
the lib code with const statements.

PR-URL: #541
Reviewed-By: Ben Noordhuis <[email protected]>
@cjihrig

cjihrig commented Jan 21, 2015

Copy link
Copy Markdown
Contributor Author

Thanks! Landed in 804e7aa

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig cjihrig closed this Jan 21, 2015
@cjihrig
cjihrig deleted the consts branch January 21, 2015 21:23
@mgol

mgol commented Feb 4, 2015

Copy link
Copy Markdown
Contributor

I personally wouldn't object to a PR that let/const-ifies all the things, noisy though it may be. I'm sure it will shake out a few bugs.

@bnoordhuis If that's still true, I might help. :) I've never contributed to Node.js but I've worked for the past 2 years on a purely let/const codebase; besides, going through the files will make me a little familiar with the project, opening the way for potential future contributions.

We might even blacklist var with a linter if that's OK by the committee.

I know @chrisdickinson is working on switching the linting to ESLint; that might generate a diff touching most JS files at least a little so perhaps it'd be best to wait until that happens?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis

bnoordhuis commented Feb 8, 2015

Copy link
Copy Markdown
Member

@mzgol It recently transpired that let/const still blocks some optimizations in the version of V8 that ships with io.js. I'm afraid that we'll have to take a conservative approach for now. Hopefully the next upgrade will fix that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mgol

mgol commented Feb 8, 2015

Copy link
Copy Markdown
Contributor

Sure, in that case it's better to wait a little.

Michał Gołębiowski

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Sep 13, 2021
[Snyk] Fix for 1 vulnerabilities solebox/node#24
Open
[Snyk] Fix for 1 vulnerabilities enterstudio/node#23
Open
[Snyk] Fix for 1 vulnerabilities s4sc/node#23
Open
@molllyn1 molllyn1 mentioned this pull request Jun 20, 2023
[Snyk] Fix for 1 vulnerabilities molllyn1/node#80
Open
@karencapiiro karencapiiro mentioned this pull request Jun 20, 2023
[Snyk] Security upgrade semver from 6.3.0 to 7.5.2 karencapiiro/node#11
Open
@AshdonG AshdonG mentioned this pull request Jun 20, 2023
[Snyk] Security upgrade semver from 6.3.0 to 7.5.2 AshdonG/node#9
Open
@Mcculloughj Mcculloughj mentioned this pull request Jun 20, 2023
[Snyk] Security upgrade semver from 5.7.1 to 7.5.2 Mcculloughj/node#64
Open
@awaisab172 awaisab172 mentioned this pull request Jun 20, 2023
[Snyk] Fix for 1 vulnerabilities awaisab172/node#45
Open
@aliscco aliscco mentioned this pull request Jun 20, 2023
[Snyk] Security upgrade semver from 6.3.0 to 7.5.2 aliscco/alisco-node#424
Open
@dannybrown13 dannybrown13 mentioned this pull request Jun 20, 2023
[Snyk] Security upgrade semver from 6.3.0 to 7.5.2 dannybrown13/node#27
Open
@ambai ambai mentioned this pull request Jun 20, 2023
[Snyk] Security upgrade semver from 6.3.0 to 7.5.2 ambai/node#15
Open
@ZRDK ZRDK mentioned this pull request Jun 20, 2023
[Snyk] Security upgrade semver from 6.3.0 to 7.5.2 ZRDK/node#8
Open
@leonardoadame leonardoadame mentioned this pull request Jun 20, 2023
[Snyk] Security upgrade semver from 6.3.0 to 7.5.2 leonardoadame/node#12
Merged
@s4sc s4sc mentioned this pull request Jun 21, 2023
[Snyk] Fix for 1 vulnerabilities s4sc/node#31
Open
@olegnn olegnn mentioned this pull request Jun 21, 2023
[Snyk] Security upgrade semver from 5.7.1 to 7.5.2 olegnn/node#44
Open
@KamilPolivka KamilPolivka mentioned this pull request Jun 21, 2023
[Snyk] Fix for 1 vulnerabilities KamilPolivka/node#29
Open
@saurabharch saurabharch mentioned this pull request Jun 21, 2023
[Snyk] Fix for 1 vulnerabilities saurabharch/node#32
Open
@jhudaz jhudaz mentioned this pull request Jun 21, 2023
[Snyk] Fix for 1 vulnerabilities jhudaz/node#52
Open
@saeedahassan saeedahassan mentioned this pull request Jun 21, 2023
[Snyk] Fix for 1 vulnerabilities saeedahassan/node#44
Open
@Mcculloughj Mcculloughj mentioned this pull request Jun 21, 2023
[Snyk] Security upgrade semver from 6.3.0 to 7.5.2 Mcculloughj/node#65
Open
@dannybrown13 dannybrown13 mentioned this pull request Jun 21, 2023
[Snyk] Security upgrade semver from 6.3.0 to 7.5.2 dannybrown13/node#29
Open
@fishbar fishbar mentioned this pull request Jun 21, 2023
[Snyk] Fix for 1 vulnerabilities fishbar/node-1#34
Open
@Qdigital Qdigital mentioned this pull request Jun 21, 2023
[Snyk] Fix for 1 vulnerabilities Qdigital/node#41
Open
@smclinden smclinden mentioned this pull request Jun 21, 2023
[Snyk] Security upgrade semver from 6.3.0 to 7.5.2 smclinden/node#10
Open
@AyushG3112 AyushG3112 mentioned this pull request Jun 22, 2023
[Snyk] Fix for 1 vulnerabilities AyushG3112/node#32
Open
@saeedahassan saeedahassan mentioned this pull request Jun 22, 2023
[Snyk] Security upgrade semver from 5.7.1 to 7.5.2 saeedahassan/node#45
Open
@karencapiiro karencapiiro mentioned this pull request Jun 22, 2023
[Snyk] Security upgrade semver from 6.3.0 to 7.5.2 karencapiiro/node#14
Open
@baophucct baophucct mentioned this pull request Jun 22, 2023
[Snyk] Fix for 1 vulnerabilities baophucct/node#35
Open
@BryanLaura BryanLaura mentioned this pull request Jun 22, 2023
[Snyk] Security upgrade semver from 6.3.0 to 7.5.2 BryanLaura/node#34
Open
@aliscco aliscco mentioned this pull request Jun 22, 2023
[Snyk] Fix for 1 vulnerabilities aliscco/alisco-node#540
Open
@adamlaska adamlaska mentioned this pull request Jun 23, 2023
[Snyk] Fix for 1 vulnerabilities adamlaska/node#110
Open
This was referenced Jul 8, 2023
[Snyk] Security upgrade semver from 6.3.0 to 7.5.2 leonardoadame/node#100
Open
[Snyk] Fix for 4 vulnerabilities leonardoadame/node#133
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@cjihrig @vkurchatkin @bnoordhuis @wavded @rvagg @mgol
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.