daokoder / dao-modules

Dao Standard Modules
http://daovm.net
12 stars 5 forks source link

Bug: declaration should specify only supported types instead of @T #14

Closed dumblob closed 10 years ago

dumblob commented 10 years ago

The declaration DaoBinary_ReadArr,"fill(self: io::stream, dest: array<@T>, count = 0) => int" doesn't match the DaoBinary_ReadArr() function as the case construct inside assumes only a few variants and doesn't have a default branch (i.e. the size_t size; declaration will implicate garbage in size when passing it to the fread() at the end).

Night-walker commented 10 years ago

There can't be anything but one those four types: int, float, double and complex.

dumblob commented 10 years ago

I was thinking e.g. about bigint - not sure if it'll be supported by the array type, so I wanted to be sure nothing bad will happen.

Night-walker commented 10 years ago

I'm sure it wasn't, isn't and will not be used like that. Array can possibly contain only fixed-size primitive types, so that the values are laid out in a continuous block of memory. bigint is variable-size and, moreover, it has actually become a class.

dumblob commented 10 years ago

Ok, I wasn't sure about the fixedness and type-checks done by the array type itself. Closing as not a bug.