Open rwaldron opened 6 years ago
This wouldn't work in the current formulation, as it is limited to functions (as opposed to methods). Do you think this use case is important enough that you think we should care?
WRT parameters, this is the current formulation:
https://github.com/samuelgoto/proposal-block-params#bindings
Which granted would be a bit awkward in this case.
On Thu, Nov 9, 2017 at 11:17 AM, Rick Waldron notifications@github.com wrote:
I didn't see any examples of this, so I'm curious:
let numbers = [1, 2, 3];let mapped = numbers.map { // ... }
Does this work? How would I get the value, index, object args?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/samuelgoto/proposal-block-params/issues/18, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqV6oo14hFVRgTeSzCRSiRMVH0v1cYGks5s00-9gaJpZM4QYgLs .
-- f u cn rd ths u cn b a gd prgmr !
https://github.com/samuelgoto/proposal-block-params#bindings
Hopefully any suggestions that include special properties of a this
object are off limits until https://github.com/samuelgoto/proposal-block-params/issues/16 is resolved.
To be clear, this is as close as it would get in the current formulation (without any assumptions made on the this
reference).
let numbers = [1, 2, 3];
let mapped = map(numbers) do (value, index) {
// ...
console.log(`${value} ${index}`);
}
Does that sound reasonable?
I didn't see any examples of this, so I'm curious:
Does this work? How would I get the value, index, object args?