archives

« Bugzilla Issues Index

#809 — the result of DefineOwnProperty


Table 8 says that [[DefineOwnProperty]] returns a Boolean.

(1) It would be helpful if the Description said what the return-value means.

(2)
Many invocations of [[DefineOwnProperty]] ignore the fact that it has a result. Are these invocations implicitly asserting that the result is true?

(3)
When the result isn't true, it's generally either false (if the 'Throw' argument is false) or an abrupt completion (if the 'Throw' argument is true).

However, in 15.4.5.1 "[[DefineOwnProperty]] (P, Desc, Throw)", step 3.d says:
If newLen is not equal to ToNumber( Desc.[[Value]]),
throw a RangeError exception.
meaning that the result can also be an abrupt completion if 'Throw' is false. Is this intentional?

(4)
In 13.3 "Method Definitions",
under "Runtime Semantics: Property Definition Evaluation",
rules 1+2+3+4 steps 9+10 say:
9. Let status be the result of calling the [[DefineOwnProperty]]
internal method of object with arguments propName, desc, and false.
10. ReturnIfAbrupt(status).

But since the 'Throw' argument is false, I believe status can only be abrupt via the anomaly in point (3) above. Is this the intent (i.e., that's the only case that 10 is meant to catch), or should the 'Throw' arg be true?

Similarly in:
15.4.4.19 "Array.prototype.map", step 10.c.v
15.4.4.20 "Array.prototype.filter", step 11.c.v.1
15.5.4.10 "String.prototype.match", step 10.g.iv.7
15.12.2 "parse", algorithm 2, step 3.a.iv.3.a + 3.b.ii.3.a

And similarly the various places that invoke [[DefineOwnProperty]] with 'Throw' = false, and then assert that the result isn't an abrupt completion. Are they merely asserting that the anomaly in point (3) doesn't occur?

(5)
In 15.13.6.5.1 "[[DefineOwnProperty]] ( p, desc, throw )",
steps 1+2 say:
1. Let succeeded be the result of calling the default [[DefineOwnProperty]]
internal method (8.12.9) on A passing P, Desc, and Throw as arguments.
2. If succeeded is false, return false.

I'm guessing step 2 should also handle any abrupt completions, so it should
probably be:
2. If succeeded is not true, return succeeded.


I think these points were more or less resolved in rev12 and rev13.