-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
Replace es6-map with a simple implementation of a map. #134
Conversation
@@ -1,4 +1,4 @@ | |||
import Map from 'es6-map'; | |||
import Map from './simple-map'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simple-map
is very generic. What about calling it simple-weak-map
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that is fitting, as keys are not weakly referenced like in a WeakMap. Your call though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a weak map. Nor is a weak map required here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I have suggested "weak map" is because keys are objects. @benjamingr Can you suggest a better name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Map
, in regular ES2015 maps keys can be objects.
A WeakMap is a map that does not interfere with the garbage collection of its keys. If you'd like to see an example of why one would want to use it - see http://stackoverflow.com/questions/29413222/what-are-the-actual-uses-of-es6-weakmap . The "weakness" of the weak map is in that it holds the reference to the keys weakly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats useful. Thank you. Will keep it as simple-map
then.
This should probably fall back to ES2015 maps if they are available. |
#133
Also, changed the
npm run pragmatist
command so that it works on windows as well.