You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've considered stuff like this in the past and eventho I really like how much cleaner it is compared to new SizedArrayType(u8, 100). I am conflicted if this magic is something we should want for the library.
I've been playing around with this but it seems like there are the following issue's we would need to sort out.
Array's and Struct's are easy to do. They're essentially objects and arrays in js which we can easily convert. The problem comes when we start looking at BitFlags, Tuple, Union and TaggedUnion types. These also use objects or arrays as descriptor which means it is not safe to directly map a js object to a Struct type or a js array to ArrayType
There are also complex types that do not have a js equivalent to describe them like PrefixedString(lengthCodec) & FixedLengthString(len). These don't have descriptors and are described by constructing specific instances.
This will likely always incur a performance hit when constructing any object, with the sugarcoat or not, because we still have to detect the sugarcoat.
Until we can solve 1 and 2 (and hopefully 3 aswell) I don't think it should be implemented in byte type.
Copied from From #45
NeKzor
MierenManz
MierenManz
The text was updated successfully, but these errors were encountered: