-
Notifications
You must be signed in to change notification settings - Fork 2k
Documents do (x=1, y=2) -> syntax #2660
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
Conversation
👍 |
Thanks, @icambron! |
+1 |
Sounds unjashkenasy to me. Has our BDFL ever accepted variable shadowing in general?
Actually it's the FE that creates a new scope.
|
@satyr, yes of course it's the IIFE that does the job. When documenting this, are we to discuss the implementation or the abstraction? Is the second example a bug in the way Finally, my understanding is that @jashkenas discourages the use of
That some people have espoused. |
I don't like it. I'd like to see some mention of its relation to a
Not quite. You're trying to show off a common pattern of using these two features together. The
...no? Where did that idea come from? |
Being accurate never hurt. I'd rather like to see a full explanation of |
@michaelficarra > Where did that idea come from?
|
If you do not assign a value, it transpiles this:
Into:
This is what you want when you are trying to generate functions and fix a value for
However, if there is no
This transpiles to:
|
Long story short, there are three use cases:
The third case is considered un-coffeescript-y. |
Or |
Elegant, and works well when programming in strict style (obviously, the semantics for |
I like this too and I'm happy to do it. Would it be helpful to submit a separate issue and pull request? Or should we try to arrive at a consensus here and I'll update the docs here? |
Kind of redundant since it's a normal JS idiom (and the doc assumes fluent JSers), but mentioning it doesn't hurt I guess.
Former perhaps to reset noise. |
I'd prefer it all stay here. Push new commits, we'll squash when we merge it. That way we have the entire conversation in one place. |
Ok, to summarize what I'm going to do:
Agreed? |
@raganwald: That sounds good to me. |
Sugar for an invocation ( |
Yes, sugar for an invocation with specific rules about how it assigns values to the arguments. |
add license information to the gemspec
I'm missing the |
It's not missing, it's just that we already have it. The paragraph was only moved. |
Question: Does this pull request need any further action from me? @jashkenas? @Nami-Doc? |
I don't have any influence on this, sorry :p. |
Yep, it does -- can you amend it to remove the regenerated example bits of code? We'll do that part when we tag a release. |
…m, to get it out of the way
Signed-off-by: Reg Braithwaite <[email protected]>
Sorry about this -- my delay has caused this PR to get woefully out of date, and GitHub is currently showing all kinds of crazy unrelated stuff in the merge diff. Closing, but feel free to resubmit a fresh copy. |
The existing documentation explains:
Version 1.3.1 added the ability to use
do
to protect variables from being hoisted:This commit documents this pattern under the variables and scoping section.