I think an easier way to store binary data in v8 would be a good addition to the api. I have filed a feature request for this, http://code.google.com/p/v8/issues/detail?id=270. This is not something we in the v8 team need so it's not something we're likely to implement any time soon but if someone wanted to contribute an implementation we'd certainly be open to that (see http://code.google.com/p/v8/wiki/Contributing).
On Tue, Mar 10, 2009 at 6:51 PM, Stephan Beal <[email protected]> wrote: > > On Mar 10, 1:47 pm, Ryan Dahl <[email protected]> wrote: >> A v8 byte array type would be nice (which had, say, some toString() >> methods for various encodings). I know google gears has binary Blobs, >> the XMLHttpRequest level 2 has a ByteArray (but doesn't specify what >> it would do), I think AIR and various other systems (?) also have it. >> It seems like a reasonable thing to have in v8. > > How does this interface sound to you: > > ByteArray([int len]); > int operator[int index]; > void close(); // forces freeing of the underlying array > string toString(); // what encoding? > string toAscii(); // convert up to first entry >127. > int length(); // in bytes > > Conversions to misc. string representations could/should be done via > add-on functions, i think. > > Internally we could could use (unsigned char *) instead of JS Array-of- > Integer (which would be extremely costly). > > :-? > > > --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
