Hi,

We followed spec text
<https://tc39.es/proposal-explicit-resource-management/#sec-getdisposemethod>
to implement the feature. According to that:

GetDisposeMethod
...
a. Let method be ? GetMethod(V, @@asyncDispose).
b. If method is *undefined*, then
      i. Set method to ? GetMethod(V, @@dispose).

So when the [Symbol.asyncDispose] is defined, [Symbol.dispose] will not be
used. I am not sure why the description in the Github repository is not
consistent with the spec text.

Please let me know if you have any other questions!
Bests,
Rezvan

On Wed, Apr 23, 2025 at 10:04 AM Marja Hölttä <[email protected]> wrote:

> cc rezvan
>
> On Wed, Apr 23, 2025 at 5:44 PM ClearScript Developers <
> [email protected]> wrote:
>
>> Hello!
>>
>> Consider the following:
>>
>> async function foo() {
>>     await using x = { [Symbol.asyncDispose]: 0, [Symbol.dispose]: () =>
>> {} };
>> }
>> await foo();
>>
>> This throws "TypeError: Symbol(Symbol.asyncDispose) is not a function".
>>
>> Is that a bug? According to our reading of the proposal
>> <https://github.com/tc39/proposal-explicit-resource-management>, the
>> synchronous fallback should be used if [Symbol.asyncDispose] exists but
>> isn't a function. From the proposal:
>>
>> let $$dispose = x[Symbol.asyncDispose];
>> if (typeof $$dispose !== "function") {
>>   $$dispose = x[Symbol.dispose];
>> }
>>
>> Thanks!
>>
>> --
>> --
>> v8-dev mailing list
>> [email protected]
>> http://groups.google.com/group/v8-dev
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "v8-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion visit
>> https://groups.google.com/d/msgid/v8-dev/41a93f7b-1ea5-49f7-b0d1-87445a3e2493n%40googlegroups.com
>> <https://groups.google.com/d/msgid/v8-dev/41a93f7b-1ea5-49f7-b0d1-87445a3e2493n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
>
>
> Google Germany GmbH
>
> Erika-Mann-Straße 33
>
> 80636 München
>
> Geschäftsführer: Paul Manicle, Liana Sebastian.
>
> Registergericht und -nummer: Hamburg, HRB 86891
>
> Sitz der Gesellschaft: Hamburg
>
> Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten
> haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter,
> löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen,
> dass die E-Mail an die falsche Person gesendet wurde.
>
>
>
> This e-mail is confidential. If you received this communication by
> mistake, please don't forward it to anyone else, please erase all copies
> and attachments, and please let me know that it has gone to the wrong
> person.
>

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/v8-dev/CAGmR0oYJ-KMEJux%3DsVyxeF_mov3k-S0eJ4DO5%3D0qJp-%3DJUbYBQ%40mail.gmail.com.

Reply via email to