-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Object properties indexed by symbols #494
Comments
You may have noticed several ways in which Sanctuary does not accommodate new language features. This reflects my view that the majority of new language features are unnecessary and primarily serve to increase the complexity of the language. Examples:
Ecma-262 Edition 5.1 is and will remain the best version of the language, from my perspective. The majority of language features added since June 2011 address problems which would have been better addressed by libraries. Now to your question about using symbols. I don't think Sanctuary will ever provide a function which deals with symbols explicitly (though polymorphic functions such as |
Yes ! In fact that was how I dealt with it :-). I have also mixed feelings about the new language features so I understand your point of view on this matter and mostly agree with it. I am closing the issue for now but feel free to reopen it if needed. |
We will see. I believe the broader JavaScript community will eventually realize that it is the continually increasing complexity of the language which is unsustainable. ;) |
Can you expand on this point a little David? |
@tomkel prefixed methods using strings is in the Fantasy Land spec. |
As I understand it, symbols were intended to give implementors a way to attach properties to an object which are guaranteed not to collide with properties added by third parties. I could write object[symbol] = "can't touch this"; and be sure that even if I give you
Authors of algebraic data type libraries need access to the various strings or symbols (currently these values are strings such as |
I don't think you're being entirely fair to modern ECMAScript. There is a lot of good stuff in there 😄
Which features? I can think of very few new features that could have been better addressed by libraries. Stuff like generators, I can only speak for my self but I've gotten so used to the new features that writing in ES5 feels like a significant step-down. I now get nervous when I see a |
I'm a Lisper at heart, Simon: highlighted words in my text editor feel like errors. ;)
We should certainly consider this. We could decide which feature is most important to us, consult the MDN compatibility table, then poll Sanctuary users to determine the proportion of users who would be negatively affected were we to use the feature. |
Thanks for pointing me to that post David. I agree that the benefits of moving to symbols (cleaner, less chance of collision) are not worth forcing the whole community to migrate. I just want to point out that cross-realm symbols are possible with |
Well put. 🤣 |
Hello,
Currently all Object methods consider that an
Object
property can always be accessed through its name as aString
.ES6 has introduced symbols and the need to access a property through a Symbol can occur sometimes.
So I was wondering what will be the preferred
Sanctuary
way to handle this use case.The text was updated successfully, but these errors were encountered: