Should ES6 global variable "Promise" be changed in examples in the docs?
See original GitHub issueWith ES6 coming and Promise
being a reserved keyword in ES6, should we encourage users to use a different variable (other than Promise
) when using Bluebird? Bluebird
seems like a good replacement candidate.
I’d be willing to do a PR if others think this is a good idea. I would have thought it’d been brought up before, but couldn’t find a ticket. I’m still wondering if there is some other reason it hasn’t been changed, so I wanted to ask before taking the time to do a PR (since it’s not quite as simple as just finding and replacing).
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:21 (2 by maintainers)
Top Results From Across the Web
Promise - JavaScript - MDN Web Docs
The Promise object represents the eventual completion (or failure) of an asynchronous operation and its resulting value.
Read more >javascript - Why is my variable unaltered after I modify it inside ...
One word answer: asynchronicity. Forewords. This topic has been iterated at least a couple of thousands of times here in Stack Overflow.
Read more >Understanding Variables, Scope, and Hoisting in JavaScript
This tutorial will cover what variables are, how to declare and name them, and also take a closer look at the difference between...
Read more >ECMAScript 6: New Features: Overview and Comparison
Support for constants (also known as "immutable variables"), i.e., variables which cannot be re-assigned new content. Notice: this only makes the variable ......
Read more >Promise - The Modern JavaScript Tutorial
Later we'll see how “fans” can subscribe to these changes. Here's an example of a promise constructor and a simple executor function with ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Hashnode Post
No results found
Man, if I had a dime for everytime I got a message like this (this one is copy and pasted from earlier today):
These kinds of issues will always exist, but can be minimized with the official docs championed
const Bluebird = require('bluebird');
, etc.Promise
is not a reserved keyword. It’s the name of a built-in object, the identifier for a global variable. Shadowing it is not a problem, it actually is what we aim to do here.