- From: Jake Archibald <notifications@github.com>
- Date: Fri, 16 Sep 2022 10:26:54 -0700
- To: whatwg/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 16 September 2022 17:27:07 UTC
https://webidl.spec.whatwg.org/#dfn-distinguishable It isn't clear to me why callbacks and dictionaries can't be distinguished. I'm designing an API like: ```js whatever(callback); ``` But there's a strong possibility that options will be added in future, and I want to avoid this pattern: ```js whatever(() => { // Quite // a // bit // of // code }, { behaveDifferently: true }); ``` And instead go for: ```js whatever({ behaveDifferently: true, callback() { // Quite // a // bit // of // code } }); ``` But it seems like I can't overload from `whatever(callback)` to `whatever({ callback })`. I would have assumed that an argument could be treated as a callback if it's callable. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/webidl/issues/1191 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/webidl/issues/1191@github.com>
Received on Friday, 16 September 2022 17:27:07 UTC