And the magic length behavior is also spec'd (Section 15.4):
"...whenever the length property is changed, every property whose name
is an array index whose value is not smaller than the new length is
automatically deleted."  So an implementation where that isn't true is
non-compliant.

It seems to me the spec on the first behavior is a bit less clear
(Section 15.3.4.3):  "If argArray is either an array or an arguments
object, the function is passed the (ToUint32(argArray.length))
arguments argArray[0], argArray[1], ..., argArray[ToUint32
(argArray.length)–1]".  That doesn't necessarily completely rule out
actually using the passed-in array to accomplish that, but I can't
*imagine* an implementation doing it (talk about dodgy practice).  If
none of the current implementations do (which is easily checked; mod
the array in the called function and look for the effect in the
caller), it doesn't seem like anything to worry about.

Sounds good to me.  Nice one, Robert!
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Mar 11, 11:19 pm, Tobie Langel <tobie.lan...@gmail.com> wrote:
> On Mar 11, 7:38 pm, Robert Kieffer <bro...@gmail.com> wrote:
>
> > Yeah, it's a nice little trick.  And, yes, it does look a little
> > fishy, but I couldn't think of any reason why it wouldn't work.
>
> For it not to work you would need the two following conditions:
>
> 1. Function.prototype.apply passing it's second argument directly to
> the function object instead of using it to repopulate a new arguments
> object (as per specs), and
> 2. the length property of array object to loose it's magical behaviour
> (which, when set, deletes arguments >= to it).
>
> Such an implementation would have a lot more issues than breaking your
> implementation of Function.prototype.bind.
>
> I'm therefore completely in favor of rewriting the whole of
> function.js taking this into account.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to