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

Make Promise requireable #1129

Closed
andrewdeandrade opened this issue Mar 12, 2015 · 6 comments
Closed

Make Promise requireable #1129

andrewdeandrade opened this issue Mar 12, 2015 · 6 comments

Comments

@andrewdeandrade
Copy link

Like issue #157, make Promise requirable. It's not a reserved ES6 keyword, so it would be nice to be able to not have to use it as a global (just like you can require('process'), require('buffer'), require('timers') and require('console').

(cc: @lxe @Raynos)

@kyriosli
Copy link

I thought `Promise' was introduced in ES6, as a global field just like String, RegExp, Date, etc

@vkurchatkin
Copy link
Contributor

Promise is defined by ES specification as a property of the global object. Scripts using require('promise') instead of Promise would become less portable for no good reason. Also there is already promise package on npm.

@Willyham
Copy link

Seems to go against #157 which was merged. The same sentiment also applies for all es6 globals (Promise, Symbol, Map, Set, WeakMap, WeakSet, Proxy, Reflect) and I guess also things like 'Date' and 'Math'.

Can we at least be consistent with the way globals are handled?

@bnoordhuis
Copy link
Member

@Willyham The difference is that process is an io.js special. Promise and the others you mention are standardized.

@andrewdeandrade
Copy link
Author

In hindsight, we should be able to get this via globals

https://www.npmjs.com/package/globals

var Promise = require('globals').Promise;

@timoxley
Copy link
Contributor

I don't really understand the usecase of this. Are you also keen on requiring other built-ins String, Number, Math, etc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants