5 Jan 2025 |
loke | Ah, the glyphCount . OK, that's good. Is this true for all cases where you get an array back? | 14:56:31 |
brian_e | I don't know of an exception off the top of my head | 14:57:35 |
loke | I'm going to keep it in native form, but present a façade that makes it look like an array to the programmer. | 14:57:37 |
brian_e | huh? how would you do that? :o | 14:58:02 |
loke | I'm sure you can do the same in BQN, but you'd have to go to a lower level. | 14:58:06 |
loke | Well, I leverage the fact that Kap uses lazy arrays. So it's a lazy array that only computes the underlying value when needed. | 14:58:40 |
brian_e | ha nice | 14:58:49 |
brian_e | Looked a bit more. Either the length of output is given via an argument to a function, or as a mutated pointer that results in the output length, or in the output struct, or it's literally not a array like the sound buffer pointers. | 15:03:26 |
brian_e | * Looked a bit more. Either the length of output is given via an argument to a function, or as a mutated pointer that results in the output length, or in the output struct, or the pointer isn't an array like the sound buffer pointers. | 15:04:06 |
dzaima | ↰ loke presumably that'd mean that you'd get segfaults if you indexed the array after an UnloadFont ? | 15:08:14 |
dzaima | * presumably that'd mean that you'd get segfaults (or worse) if you indexed the array after an UnloadFont ? | 15:08:20 |
dzaima | I suppose you could track loadedness and make indexing an error if unloaded | 15:11:14 |
loke | Yes. But since the value was returned from LoadFont , I can mark it as unused after UnloadFont so I can raise an error if someone tries that. | 15:11:16 |
brian_e | wonder what joining two glyph arrays would do. I'd imagine join needs the lengths. | 15:11:18 |
dzaima | that's an extremely weird array though | 15:11:43 |
loke | Actually, since the size is known, the result of the join is also a lazy value. | 15:11:47 |
loke | It's a lazy array backed by two lazy arrays, so at no point would it touch the content. | 15:12:09 |
brian_e | oh so you're going to implement manually getting sizes of all the arrays from different places? | 15:12:54 |
loke | Not sure. I can do that. Not sure if I should. | 15:13:20 |
brian_e | hmm alright. what if i index at 5, when would this new lazy array know to switch to the second array? It'd have to know the length of the first. | 15:13:58 |
loke | Yes, exactly. You can't create a lazy array without knowing its size. | 15:14:40 |
loke | So the lazy array knows what offsets the underlying arrays can be found, so it just computes the correct position and calls the underlying array. | 15:15:16 |
brian_e | O right! almost forgot. Also remember that some functions return null terminated strings. | 15:15:39 |
loke | Yeah, right now I just assume that all const char * are strings. How true is this? | 15:16:30 |
brian_e | are arrays in Kap mutable? | 15:16:39 |
loke | No, they're not. | 15:16:52 |
loke | But I need to read the entire string to determine its length, since UTF-8 is a variable-length encoding. So it just generates an APL string from it. | 15:17:52 |
brian_e | i thought it was true. when isn't it? | 15:21:42 |
brian_e | oh sorry, you replied to my message | 15:22:10 |
loke | It's never mutable. You have to create a new array to change it. | 15:22:15 |