+1 Ray. Now here's the really tricky question. Is there any way we can take
advantage of Javascript's "for (x in y) { ... }" syntax (and should we,
given its spotty performance)? My intuition tells me that the only way we
could use it would be through a callback, because there's nothing like .NET
generators/yield in Javascript.
On Wed, Jun 10, 2009 at 7:26 PM, Ray Cromwell <[email protected]> wrote:
> My take on this is that there is many places where I'd like to avoid
> JRE collections, but the basic JsArray is too much of a downgrade. I
> don't mind changing it to <T> if it doesn't effect performance cause
> then I could subclass it, but as an example of the stuff I would like
> in a 'FastArrayList' that is not a collections derivative:
>
> 1) add() instead of just set(length(), item) (e.g. push)
> 2) addAll(anotherFastArrayList) (e.g. concat)
> 3) splice
> 4) toArray() (webmode is reinterpret cast op)
> 5) remove
> 6) shift/unshift (useful for queue when combined with pop)
>
> I use the following pattern all over GQuery to avoid JRE collections
> but preserve for-each
>
> for(Foo f : fooList.elements()) { ... }
>
> where fooList is my own JsArray<T> class, and elements() returns T[]
> via reinterpret cast in webmode.
>
> -Ray
>
>
>
> On Thu, Jun 11, 2009 at 2:43 AM, Lex Spoon<[email protected]> wrote:
> >
> > Bah, mis-send. What I was typing was:
> >
> >
> >> I though the point was to get rid of JRE collections? Anyway, the
> >> collection in question is used as a queue. I would hate to see its
> >> performance get worse when there'
> >
> > ...when there's a known, straightforward alternative, and when that
> > alternative provides a class people have been wanting for separate
> > purposes.
> >
> >
> > Lex
> >
> > > >
> >
>
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---