- From: Domenic Denicola <notifications@github.com>
- Date: Wed, 25 Mar 2020 10:46:06 -0700
- To: heycam/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <heycam/webidl/pull/862/review/381390239@github.com>
@domenic commented on this pull request. > + + 1. If |definition| has an [=indexed property getter=], then: + 1. Perform [=!=] [$CreateMethodProperty$](|target|, {{@@iterator}}, + {{%ArrayProto_values%}}). + 1. If |definition| has a [=value iterator=], then: + 1. Assert: |definition| has an [=indexed property getter=]. + 1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>entries</code>", + {{%ArrayProto_values%}}). + 1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>keys</code>", + {{%ArrayProto_keys%}}). + 1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>values</code>", + {{%ArrayProto_values%}}). + 1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>forEach</code>", + {{%ArrayProto_forEach%}}). + 1. If |definition| has a [=pair iterator=], then: + 1. Define the {{@@iterator}} and <code>entries</code> methods: This turns out to be difficult because the steps close over _definition_. We can smuggle it in as an internal slot on the function but that's a lot of effort. Ultimately I'm not sure giving these sections is that helpful: - The steps are fairly repetitive, with the non-forEach ones varying only in key/value/key+value. - You still have 4-5 lines per method of CreateBuiltinFunction, SetFunctionName, SetFunctionLength, and CreateDataProperty/CreateMethodProperty. That is, if we move the steps out, then we just have 17 steps next to each other repeating calls to those five abstract ops. Which is harder to read, IMO, than the current version. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/heycam/webidl/pull/862#discussion_r398049849
Received on Wednesday, 25 March 2020 17:46:19 UTC