-
Notifications
You must be signed in to change notification settings - Fork 36
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
Optic doesn't support Symbol. #166
Comments
Yes, currently Partial Lenses do not support symbols and in non-production mode the library raises an exception as seen here. I'm not opposed to supporting symbols, but I'm not entirely sure what the best way to support them would be. Ramda, for example, does not currently support symbols. It seems that the use case of symbols is to avoid name clashes. I did some quick tests and it seems that copying symbol properties (using builtin For the above two reasons, namely
I'd rather not enhance the default property lenses in Partial Lenses to support symbol properties at this point. The above concerns may change in the future (IOW, a consensus may be reached and copying symbol properties might get significantly faster) at which point this could be reconsidered. Note that you can always write custom optics for accessing objects with symbol properties. Here is a simple example using Also, it might be useful to add the above |
I read your example. However, the variable name like xi2yF confuse me. What it's name mean? When I want to read this project source code. This problem tangle me, I want to contribute my code, but first , how to understand this, which knowledge I miss. Thanks |
Ah... Good question. |
Also, my latter example had a bug—I just fixed the link. |
Got it ,thanks |
@polytypic |
@Justin-ZS Oops. Thanks for the correction! Here is the fixed playground. |
If someone, like me, needs to not loose Symbols using lenses this a patch I have done to infestines.
|
Well, Optic is support String, Array ...etc
However, the ES6 new type Symbol is mostly support by modern browser and Node.js.
But, if we create a new Optic like this:
The error is throw.
The text was updated successfully, but these errors were encountered: