You didn't come across as abrasive at all - JavaScript has caused a few profanity-laden exclamations from me too :)
The only frustrating thing about typed arrays is:
var a = new Uint8Array(10);
var b = new Uint8Array(a); // data copied
var c = new Uint8Array(a.buffer); // data not copied
StringView would make a lot of sense actually - or some way to get strings from a uint8array. I've actually added E.toArrayBuffer for strings so the simplest way might be to add the reverse function too though.
In terms of adding to ArrayBuffers, what I tend to do is:
var source = new Uint8Array(...);
var dest = new Uint8Array(source.length+3);
dest.set([1,2,3]);
dest.set(source, 3);
Having said that, I wonder whether SPI.send/I2C.read/etc would benefit from being able to take an arbitrary number of arguments. It might make the code simpler in a lot of cases.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
You didn't come across as abrasive at all - JavaScript has caused a few profanity-laden exclamations from me too :)
The only frustrating thing about typed arrays is:
StringView would make a lot of sense actually - or some way to get strings from a uint8array. I've actually added
E.toArrayBuffer
for strings so the simplest way might be to add the reverse function too though.In terms of adding to ArrayBuffers, what I tend to do is:
Having said that, I wonder whether
SPI.send/I2C.read/etc
would benefit from being able to take an arbitrary number of arguments. It might make the code simpler in a lot of cases.