tc39 / proposal-atomics-wait-async

"asynchronous atomic wait" for ECMAScript
https://tc39.github.io/proposal-atomics-wait-async/
Other
90 stars 18 forks source link

AgentWaiterList has at most one null, and it's always first - so isn't it just a flag? #11

Closed lars-t-hansen closed 5 years ago

lars-t-hansen commented 5 years ago

I'm a little torn about the cleverness in using a null on the AgentWaiterList to signify a blocking wait. IIUC, there can be at most one null value, and it's always first, so really it's just a flag bit, and the AWL could be a record with that flag broken out and a list of non-null records, or the flag could possibly be directly on the Agent Record.

On the one hand, it's clever. On the other hand, it introduces generality (and thus some conceptual complexity, in return for implementation simplicity) where none is really called for.

I think that if we keep the mechanism as it is, we should at least note the above useful facts about it in the third para of the intro (the one defining AWL).

syg commented 5 years ago

Indeed, it's just a flag. Maybe it serves a very small explanatory purpose to illustrate the line cutting behavior, but I agree, it's simpler to have it as a flag.