You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.
Currently exemples feels a bit bad to me, because they show potentially dangerous side-effectful functions
Here it's not harmful because the example({ foo: 'foo' }) is passed a new option object everytime, but with example(constantObject) and having the constantObject being shared could be very dangerous, as it could somehow override default option values or things like that.
I don't have a good example to suggest.
Could people that want the feature can come with beter real world code where this new proposal would actually improve the program.
I'm willing to get convinced by this proposal, and wanted to check examples for that, but it didn't really help so far (somehow, related to #2)
The text was updated successfully, but these errors were encountered:
The examples in the readme were super contrived, just meant to give an example of the syntax. What I commonly want it for are to lazy init properties on class instances. And sometimes to initialize properties deeply owned by my instances.
constlist=name=='children' ? children : props[name]||(props[name]=[]);
constlist=name=='children' ? children : props[name]||=[]);
I'd say in both cases it's not very readable, and you can probably be rewritten it in a more understandable way that would not require logical assignment operators in the first place.
Hi, I saw on reddit that the very first example is not self explanatory. Not everyone is familiar with a || (a = b); kind of syntax. Maybe try something more universal like if else.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
@DanielRosenwasser suggested I open an issue here to discuss better examples.
https://twitter.com/drosenwasser/status/1245995703559532544
Currently exemples feels a bit bad to me, because they show potentially dangerous side-effectful functions
Here it's not harmful because the
example({ foo: 'foo' })
is passed a new option object everytime, but withexample(constantObject)
and having the constantObject being shared could be very dangerous, as it could somehow override default option values or things like that.I don't have a good example to suggest.
Could people that want the feature can come with beter real world code where this new proposal would actually improve the program.
I'm willing to get convinced by this proposal, and wanted to check examples for that, but it didn't really help so far (somehow, related to #2)
The text was updated successfully, but these errors were encountered: