IRC channel logs
2025-11-05.log
back to list of logs
<dthompson>kestrelwx: I'm guessing you already know about Math.random? <cwebber>oh, yeah what I recommended was more for cryptography purposes <cwebber>if you want it for games, Math.random is better <dthompson>yeah I think kestrelwx just needs something for the game jam <kestrelwx>I think I'll see to port the `srfi-27` reference. <dthompson>kestrelwx: oh right! srfi-27! guile has that but I haven't used it. give it a shot <dthompson>ah there's just one missing thing: gettimeofday. replace that and I think it should work. <dthompson>I don't see any scheme module with that name in guile <dthompson>so if that's a valid module then it's implemented in c <kestrelwx>Sorry, I think it's not a module at all, but Guile's SRFI-27 seems to be implemented in terms of Guile's own RNG implementation. <dthompson>implementing that in hoot is on the todo list but something we haven't gotten around to <kestrelwx>Okay, I didn't ensure it's all proper, but seems to work alright. I'll clean up, try the tests it has and push the commits in a bit. I think the implementation I took is slow, but for this once that's not a problem. <kestrelwx>I think I could also make it take Math.random() instead of Date.now() too. <kestrelwx>dthompson: Oh, I wanted to ask, some WebGL procedures have return type of `any`, if they might return different results. Right now, I have `any` mapped to `(ref extern)`, so they are opaque to Scheme. Do I need to write a number of JS wrappers for each possible return type? Or is there a better way? <kestrelwx>For example `getShaderParameter` can be one of the integer number types, or it can be a string, depending on `GLenum` value passed to it by the application. Some other functions might return a typed array as well, though. <kestrelwx>I guess I could have a JS function that inspects the value and best-effort returns an `scm` value. It's also fine to go through these case by case, but I am curious in terms of binding generation. <dthompson>kestrelwx: you'll want a foreign procedure for each possible return type <dthompson>otherwise you'll have to handle things like turning ints into fixnums <dthompson>I'd need to re-read some code to see if there's a way to do this <dthompson>if there is then the return type should be (ref eq), not (ref extern) <kestrelwx>I guess I should just see if a `TypedArray` being passed to `api.scm_from_extern` raises an exceptions. `call_extern` does this conversion already, so I might already do `(ref eq)` for these. <dthompson>unsure if that's the best way. what's wrong with one function per type signature? that's what the original opengl api does, after all. <kestrelwx>I just can't know the possible types from an IDL spec, otherwise it's fine.