3 ms·
Why it uses [Symbol.dispose]: () => {} instead of just dispose: () => {} Would somebody actually add "using" without checking type?
by huksley 3y ago
Why it uses [Symbol.dispose]: () => {} instead of just dispose: () => {}
Would somebody actually add "using" without checking type?
- deleted 3y ago[deleted]
- forty 3y agoThe problem with structural/duck typing is that words can mean several things. For example `.run`ning your duck is probably very different from `.run`ning your Thread. I think the Symbol is a way to signal "this is the dispose function whose contract is defined in the JS `using` spec and not some random function that happens to be named that way".