Re: [w3c/gamepad] IDL array[]s no longer exist (#28)

> I'm not sure what you mean here. Do you mean the value of the `buttons` property or the values in the `buttons` array?
> 
> That is, are you talking about whether `gamepad.buttons === gamepad.buttons` tests true, or about `gamepad.buttons[0]`?

I'd meant the former, but what I had in mind was basically what you described in your steps.

>> Using FrozenArrays is a somewhat-breaking change though
>
> Breaking from which point of view? Spec or implementation? Gecko has been shipping frozen arrays here since https://bugzilla.mozilla.org/show_bug.cgi?id=949682 was fixed back in Firefox 29.

Spec. Gecko's been using frozen arrays, but so far there was nothing in the spec saying `Object.isFrozen(gamepad.buttons) === true` or `Object.isFrozen(gamepad.axes) === true`. I haven't seen any code assuming these were false (and thus making changes to the returned arrays) though, so my concern was only to ensure this kind of change is OK to make.

> I can't tell from code inspection what Blink does.

At the moment, as far as I can see Blink will always return a new array (so `gamepad.buttons === gamepad.buttons` is always false), but the items in the array only change when the button count changes (so in most cases `gamepad.buttons[0] === gamepad.buttons[0]` is true). Moving to a fully caching behavior is pretty easy though.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/gamepad/issues/28#issuecomment-315708468

Received on Monday, 17 July 2017 09:35:29 UTC