extensibleweb / webidl.js

An implementation of WebIDL in ECMAScript
55 stars 14 forks source link

Implement Sequences — sequence<T> type #22

Open marcoscaceres opened 11 years ago

marcoscaceres commented 11 years ago

http://www.w3.org/TR/WebIDL/#idl-sequence

marcoscaceres commented 11 years ago

Started work in parallel with Array, as they depend on each other.

marcoscaceres commented 11 years ago

WebIDL spec seems wrong. Filed bug against spec: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20731

FremyCompany commented 11 years ago

For people coming to the thread only now, the issue has been resolved and the algorithm of the spec is indeed correct. The question was about

obj["0"] vs obj[0] 

(officially, property names are always strings in ES5 so the WebIDL spec converts integers to strings; actually we should not do that because browser do not really use string indexes on array, but this only got standardized in ES6).

marcoscaceres commented 11 years ago

yeah, I didn't know that [x] becomes [String(x)] internally. Things one learns :) I also learned not to file bugs until AFTER I have actually implemented and tested.

marcoscaceres commented 11 years ago

I've got this implemented (it's in the currently in the Array type branch). However, as we don't have all the types yet, it's not possible to fully test. Regardless, the base functionality is going.