Open arteymix opened 8 years ago
Oops. I commented in the PR.
I wonder if we can make use of the elsize
argument.
Currently, when the elsize is bigger than the actual storage, the behavior of unused bytes is undefined.
new Array.full(typeof(char), 10, ....)
will define a fixed size string array, where each item is at most 10 bytes?
Looks like everything here just works if we do 3?
I'll think about all this. The string
is a very special case because it has its own type.
In general, I like the idea of handling vector-scalar with mul * sizeof (type)
:
new Array (typeof (char), 12 * sizeof (char), {10}); // 10 12-sized char arrays
It would be nice to check this particular case when printing arrays.
I wonder if this means we can have basic vector items for other types too.
new Array (typeof (double), 3 * sizeof (double), {10}); // 10 double 3-vectors
Vector items are bad because we cannot apply cast or transformation
consistently on them. I only think we should handle string
in this
particular way.
2016-11-10 14:00 GMT-05:00 Yu Feng notifications@github.com:
I wonder if this means we can have basic vector items for other types too.
new Array (typeof (double), 3 * sizeof (double), {10}); // 10 double 3-vectors
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rainwoodman/vast/issues/8#issuecomment-259776747, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQeTSiceGRGbtXbCyM2LJq42FExaUxlks5q82negaJpZM4Kt-8f .
Guillaume Poirier-Morency guillaumepoiriermorency@gmail.com
Étudiant au baccalauréat en Informatique à l'Université de Montréal Développeur d'application web
Mon blog: arteymix.github.io Mon projet de coopérative: pittoresque.github.io Clé PGP: B1AD6EA5 https://pgp.mit.edu/pks/lookup?op=vindex&search=0x1CCFC3A2B1AD6EA5
That's a fair point.
We shall strictly handle vectors as dimensions, then.
There's two way of handling strings (e.g.
typeof (string)
) that comes to my mind:char*
pointer (should be the current way)char
and we use the last shape dimension to constraint its length plus an optional\0
byte if the string happens to be smallerThis means that we would also provide vectorized string utilities that fits the representation we choose.