Open mildsunrise opened 3 years ago
the last commit also allows accessing array fields on structs
Yes, I've read the thing quickly but I have a work thing to finish by tomorrow, will be more available to review the PRs after that.
Two comments meanwhile:
FIXME
/g_assert_not_reached
/g_critical
. I like crashing rather than having UB, but would it be possible to use the ERROR(fmt, ...)
macro for all those cases?wait, the struct setters work with arrays? I thought they weren't primitives and you could only get the array, not set it
edit: according to the code, plain C arrays (the only kind of arrays where length
makes sense) can't be set via a struct setter since it would require memory management. so we're fine. in the future we could maybe omit memcpy
entirely and this would let users modify the array elements through the typed array
Yes, I've read the thing quickly but I have a work thing to finish by tomorrow, will be more available to review the PRs after that.
oh don't worry, the comment was just to keep track of the things in the PR. these PRs can perfectly wait :)
I'll fix the typo and the other two things you mentioned (test case and ERROR) when I find some time
in the meanwhile I've done some improvements to the GArray -> V8 conversion, and also implemented conversion from GByteArray GValues <-> V8
I don't think there's an easy way to implement conversions for arbitrary GArrays for now, because we don't have info about the element GType
See the commit messages for full change list, but basically
GArray
/GByteArray
We still need a memcpy, but transferring large data buffers should be much faster now.