On Feb 24, 2:43 pm, Richard Cornford <
[email protected]>
wrote:
[...]
So which other value represents "the number of *actual parameter
values supplied by" the caller*"?
Seems you didn't understand correctly, by "not only" I meant that
10.1.8 says not only the length property but also about the exact case
when properties of `arguments' object and and corresponding formal
parameters should be shared.
Only "In the cases when arg is less then the number of formal
parameters for the function" and after constraining arg to all "non-
negative integers" "less then the value of the length property".
Do I understand correctly that you argue about that if
arguments.length == 0, than implementation can share corresponding
formal *first* parameter as index-property of the `arguments[0]' is
*equal to* 0, but not less as told in spec? If so, sorry, this is just
a _too formal_ attempt to think out "how could it be if ...". And
doesn't it mean that for `arguments[1]' shouldn't share the
corresponding formal parameter (1 < 0, where 0 - is the
`arguments.length')? But it does. As it does (wrong) for
`arguments[0]'.
Your current arguing reminds some case in court when everybody
understands that it is wrong, but because of _some formal ambiguity_
(a "formal hole in the law") is will be justified. Sorry, no, it
won't.
I don't understand that last sentence.
Doesn't matter, I meant that it's possible to add new properties to
`arguments' object (but they shouldn't affect the `.length' property,
what I said in another sentence).
function foo(x) {
x = 10;
alert(arguments[0]); // should undefined
Based on what? In this case - arguments.length - is zero, and so there
is no specified value or behaviour for an - arguments[0] - property in
this case.
I said above - it's just an attempt to be hooked for ambiguity of the
specification. If Chrome is correct by your words, than it shouldn't
share `y' (let's assume it's the second parameter) and `arguments[1]'
in case when no parameters are passed. But Chrome shares them in all
that cases, which is wrong. Referencing to conformance section also
isn't fit here - because implementation can create any other
properties (as many as it want), but shouldn't disturb the description
of concrete algorithm (10.1.8 in this case; see for `arguments[1]'
then if you still want to argue about 0 == 0, but not less than).
arguments[0] = 100;
alert([
arguments[0], // should be 100
Yes it should, as the - arguments[0] - property has just been assigned
that value.
x, // should be 10, as doesn't share
That is much harder to justify. While successful assignment would not
normally be expected to have side effects on the values of the
properties of other objects I don't see anything that forbids this.
Yeah, that's true (any side effect could be, which specification
doesn't forbid), but this exact case is forbidden by 10.1.8 (again,
you can choose to analyze arguments[1], y, and the case when no
parameters passed to (x, y) function).
arguments.length // should be 0, as [[Get]] isn't overloaded
]);
And only in Chrome we have "100, 100, 100, 0", meanwhile in
other: "undefined, 100, 10, 0".
But as there is no 'correct' outcome to be derived from the
specification it is not possible to declare either to be wrong.
Interactions with 'integer index' properties of the - arguments -
object that are equal to or greater than - arguments.length - are not
specified at all.
Mentioned above, it seems like formal catching the hole in ambiguous
specification description, but I can't find useful application of it.
Then use arguments[1] and y, when .length will be 0, and Chrome will
try to share 1 which is grater than 0. Do I understand correctly that
for you statements "1 is grater than 0" (with which you're trying to
argue) and "0 is less than 1" are not equivalent for this case?
Whatever the motivation of the section, the wording of the section
specifies exact behaviour for a length property and all non-negative
'integer index' properties that are less than the length value. It
says nothing about the existence (or non-existence), value or
behaviour of 'integer index' properties that are equal to or greater
than length; there are no constraints placed on such properties in
that section.
Yeah, I mentioned it above.
It would be possible to argue that whatever is not specified is
therefore forbidden, but that position would instantly collapse at the
third paragraph of the conformance section; you cannot forbid all that
is not specified at the same time as allowing "additional types,
objects, properties and functions beyond those described in this
specification".
Section 10.1.8 specifies the values and behaviour of non-negative
integer index properties of the - arguments - object that are less
than the - arguments.length - value, and it stops there. Beyond that
the language's conformance rules allow anything that does not
contradict what is specified.
You cannot assume that. It is entirely possible that where it is
recognised at all the behaviour chosen was chosen because it was seen
as sensible.
On implementation level this should be so. Some ambiguous cases should
be treated as logical as possible, but without finding "law holes" and
choosing this way to implement (and moreover, argue after than
referencing on it).
Is that an appeal to authority?
Strange to hear that. Never. Seems, you confuse me to someone. But if
you insist: this is just _an example_.
Individuals, including those working
on script engine software, are capable of misinterpreting the
specification, reading more in that is there, or even just expressing
themselves imprecisely/poorly.
(just as I am, which is what makes having this discussion in public
worthwhile. Burred in the spec somewhere they may be something that
would make this Chrome feature an ECMAScript implementation bug. It is
not in section 10.1.8, but that does not mean that nobody here will be
able to point something out).
Yes, it could be so, but I think this case is clear although is very
ambiguous and can be appellate with references which you mention. The
other question - what is the big deal of that too formal appellations
for the implementation level? I don't see a big. Although, I clearly
understand your position.
/ds