-
Notifications
You must be signed in to change notification settings - Fork 34
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
Arguments placeholders for callbacks #837
Comments
I hadn't realized it before, but the one-argument case is a special case of #480, which increases the motivation for that proposal. It looks like imba also only supports one argument? The two-argument version is interesting. Indentation application already does this: someFunc
(argsFromFirstPlaceholder) =>
// ...some code here
(argsFromSecondPlaceholder) =>
// ...some code
↓↓↓
someFunc(
(argsFromFirstPlaceholder) => {
// ...some code here
},
(argsFromSecondPlaceholder) => {
// ...some code
}
) So what this suggests is that |
Probably yes.
With defined default parameter with callback functions: ($1 = (argsFromFirstPlaceholder) => { /* ...some code here */ }, $2 = (argsFromSecondPlaceholder) => { /* ...some code */ }) => someFunc($1, arg1, arg2, $2, arg3) from this code: someFunc(&, arg1, arg2, &, arg3)
(argsFromFirstPlaceholder) =>
// ...some code here
(argsFromSecondPlaceholder) =>
// ...some code
Maybe for that case, if has multiple different placeholders, then numerate it like: someFunc(&1, arg1, arg2, &2, arg3)
(argsFromFirstPlaceholder) =>
// ...some code here
(argsFromSecondPlaceholder) =>
// ...some code or add labels: someFunc(&cb1, arg1, arg2, &cb2, arg3)
(argsFromFirstPlaceholder) =>
// ...some code here
(argsFromSecondPlaceholder) =>
// ...some code |
Looking back at this, the idea seems close to what's offered by (setTimeout ., 1000)
=> console.log 'hello world'
---
(($) => setTimeout($, 1000))(() =>
console.log("hello world"),
); Unfortunately, currently:
|
It would be nice, if you add to civet something like this
I have this code:
And I would like to have such an opportunity as:
The text was updated successfully, but these errors were encountered: