Re: Calling Array.splice({} ) with no start
Thomas 'PointedEars' Lahn wrote:
Weren't you saying that non-square bracketed arguments were mandatory?
You inferred that 'square brackets means optional'. Then you seemed to
deny the antecedent of that inference with: if a parameter is non-square
bracketed, it is *mandatory* is faulty logic.
1. squares bracket not defined/documented.
2. other methods w/no square brackets around arguments use undefined for
missing arguments.
The square brackets don't have a defined meaning.
It was never debated that formal
It sounds like you're still arguing that the underlying algorithm is
allowed to implement unique behavior when non-square bracketed arguments
are omitted. I don't see any grounds for this argument, in practice, or
in the spec.
It seems most reasonable to go with the behavior that is set forth in
10.1.3. Since implementations do this for non-square bracketed arguments
of all other methods, it is safe to say that it is a rule. The value
undefined should be used for a missing parameter, regardless of square
brackets.
Garrett
Thomas 'PointedEars' Lahn wrote:
dhtml wrote:
>
If anything, it shows that that the specification is worded imprecisely.
Which point are you trying to make here?
>Thomas 'PointedEars' Lahn wrote:
>Shows that optional arguments are treated as undefined.
>>dhtml wrote:
>>>Thomas 'PointedEars' Lahn wrote:
>>>>dhtml wrote:
>>>>>Thomas 'PointedEars' Lahn wrote:
>>>>>>You don't get it, do you? The language standard makes the first two
>>>>>>argumen ts of the method *mandatory*,
>>>>>Apparent ly I missed the line in the spec that says 'The first two
>>>>>argument s are necessary.' [...]
>>>>*Obviously* .
>>>>>
>>>>| 15.4.4.12 Array.prototype .splice (start, deleteCount [ , item1 [ , item2 [
>>>>| , … ] ] ] )
>>>>>
>>>>Brackets usually mark optional arguments/parameters, and they do so there.
>>>Usually. But the spec has examples of sections that don't seem to follow
>>>that convention. For example:
>>>>
>>>What about slice:
>>>15.4.4.10 Array.prototype .slice(start, end)
>>>>
>>>or sort:
>>>15.4.4.11 Array.prototype .sort(comparefn )
>>>>
>>>These don't have brackets around optional arguments. The arguments are
>>>optional in all modern (non-beta) implementations .
>>Non sequitur.
>>>Thomas 'PointedEars' Lahn wrote:
>>>>dhtml wrote:
>>>>>Thomas 'PointedEars' Lahn wrote:
>>>>>>You don't get it, do you? The language standard makes the first two
>>>>>>argumen ts of the method *mandatory*,
>>>>>Apparent ly I missed the line in the spec that says 'The first two
>>>>>argument s are necessary.' [...]
>>>>*Obviously* .
>>>>>
>>>>| 15.4.4.12 Array.prototype .splice (start, deleteCount [ , item1 [ , item2 [
>>>>| , … ] ] ] )
>>>>>
>>>>Brackets usually mark optional arguments/parameters, and they do so there.
>>>Usually. But the spec has examples of sections that don't seem to follow
>>>that convention. For example:
>>>>
>>>What about slice:
>>>15.4.4.10 Array.prototype .slice(start, end)
>>>>
>>>or sort:
>>>15.4.4.11 Array.prototype .sort(comparefn )
>>>>
>>>These don't have brackets around optional arguments. The arguments are
>>>optional in all modern (non-beta) implementations .
>>Non sequitur.
If anything, it shows that that the specification is worded imprecisely.
Which point are you trying to make here?
You inferred that 'square brackets means optional'. Then you seemed to
deny the antecedent of that inference with: if a parameter is non-square
bracketed, it is *mandatory* is faulty logic.
1. squares bracket not defined/documented.
2. other methods w/no square brackets around arguments use undefined for
missing arguments.
The square brackets don't have a defined meaning.
It was never debated that formal
parameters for which no value has been passed are treated as undefined *on
call*, that is what is specified. (Why did you reiterate that anyway?)
>
But what that means for the underlying algorithm of the method and therefore
for its return value, is an entirely different matter. If the Specification
does not say how an implementation is supposed to behave in such a case, it
is wrong to say that one implementation is correct and another one is not
just because the outcomes differ.
call*, that is what is specified. (Why did you reiterate that anyway?)
>
But what that means for the underlying algorithm of the method and therefore
for its return value, is an entirely different matter. If the Specification
does not say how an implementation is supposed to behave in such a case, it
is wrong to say that one implementation is correct and another one is not
just because the outcomes differ.
allowed to implement unique behavior when non-square bracketed arguments
are omitted. I don't see any grounds for this argument, in practice, or
in the spec.
It seems most reasonable to go with the behavior that is set forth in
10.1.3. Since implementations do this for non-square bracketed arguments
of all other methods, it is safe to say that it is a rule. The value
undefined should be used for a missing parameter, regardless of square
brackets.
Garrett
>
^^^^^^^^^^^
Which part of that did you not get?
>
>
PointedEars
>>Please do not quote signatures unless you refer to them.
>>>
>>PointedEars
>>>
>>PointedEars
Which part of that did you not get?
>
>
PointedEars
Comment