Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upFactor out all ordinary object internal methods into OrdinaryXyz()? #91
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
anba
Oct 19, 2015
Contributor
You could use the same language as in 9.4.4 Arguments Exotic Objects, for example:
Return the result of calling the default ordinary object [[SetPrototypeOf]] internal method (9.1.2) on O passing V as the argument.
[[Get]], [[Set]] and [[Delete]] for arguments objects use this wording to call the ordinary internal methods.
|
You could use the same language as in 9.4.4 Arguments Exotic Objects, for example:
[[Get]], [[Set]] and [[Delete]] for arguments objects use this wording to call the ordinary internal methods. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
I guess that covers it; thanks! |
domenic
closed this
Oct 19, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Is there a reason ECMAScript uses both patterns? |
bterlson
added
the
question
label
Oct 20, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
@annevk which patterns are you referring to? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
annevk
Oct 20, 2015
Contributor
What @anba mentioned and using OrdinaryInternalMethod abstract operations.
|
What @anba mentioned and using OrdinaryInternalMethod abstract operations. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
annevk
Oct 20, 2015
Contributor
Also, if I say use "default ordinary object [[Get]] internal method", does that mean the [[GetOwnProperty]] call it does (and similar ones) are the normal non-overridden variants as well?
|
Also, if I say use "default ordinary object [[Get]] internal method", does that mean the [[GetOwnProperty]] call it does (and similar ones) are the normal non-overridden variants as well? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
allenwb
Oct 20, 2015
Member
@annevk
Choice of how to do this is mostly a judgement call by the editor. delegating to OrdinaryX abstraction operation adds a level of indirection that make the normal case harder to read/understand. Using ""default ordinary object..." (and note a section reference is always included) only adds complexity at the "call site".
If you say "call the default ordinary object [[Get]] internal method" (and you need to include a section reference) you mean exactly and only that. If you say "call the [[GetOwnProperty internal method of obj" (or just say obj.[GetOwnProperty] ) you are going throw the meta-level dynamic dispatch to the specific [[GetOwnPrperty]] associated with obj.
|
@annevk If you say "call the default ordinary object [[Get]] internal method" (and you need to include a section reference) you mean exactly and only that. If you say "call the [[GetOwnProperty internal method of obj" (or just say obj.[GetOwnProperty] ) you are going throw the meta-level dynamic dispatch to the specific [[GetOwnPrperty]] associated with obj. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
annevk
Oct 21, 2015
Contributor
It's still not clear that if you say "call the default ordinary object [[Get]] internal method" that means that the internal methods that that algorithm invokes, are also the default ordinary ones. At least not to me.
|
It's still not clear that if you say "call the default ordinary object [[Get]] internal method" that means that the internal methods that that algorithm invokes, are also the default ordinary ones. At least not to me. |
domenic commentedOct 19, 2015
HTML needs to specify a couple exotic objects. (Web IDL also needs to do so, if it ever gets updated to ES2015.) In many cases the behavior is "if flag X is set, throw. Otherwise, do what an ordinary object would do."
For a couple internal methods, there are pre-existing abstract operations we can use: OrdinaryGetOwnProperty and OrdinaryDefineOwnProperty. But for all others, there are not.
I see two potential ways we could spec such exotic objects:
Any advice? Is there a chance (1) could clean up parts of the ES spec that are currently duplicated?
/cc @annevk @allenwb