ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
dbandstra has joined #zig
<dbandstra>
andrewrk, what are you working on these days? i've been out of the loop
<dbandstra>
copy-elision-2?
<andrewrk>
dbandstra, that's right. the first attempt turned out to be the wrong approach, I think. I'm not happy with how the code turned out so far
<andrewrk>
it's a prerequisite for fixing coroutines
<andrewrk>
I took off friday and yesterday to travel for a national arcade game tournament, but now I'm back in action on Zig
<dbandstra>
haha cool
<dbandstra>
i haven't even looked at the async/coroutine side of zig yet, am i right in thinking they're totally in flux atm, even the syntax?
<andrewrk>
yes
<dbandstra>
was there some proposal where the read/write functions of std streams would become asynchronous functions?
<dbandstra>
meaning i guess you wouldn't be able to use a stream without an allocator?
<andrewrk>
in the coroutines rewrite, coroutines no longer require allocators
<dbandstra>
oh cool
<andrewrk>
the memory has to go somewhere; but it becomes very simple to have the memory go into the current stack frame (or current coroutine frame)
<andrewrk>
and it is equally simple to have the memory be in a struct, preallocated, or globally allocated, etc
<dbandstra>
do coroutines execute synchronously till the first yield?
<andrewrk>
yes
<andrewrk>
if you want to not execute till the first yield, you can just do: `var frame: @Frame(coroutine_function) = undefined`
<dbandstra>
so that means that, if base instream/outstream read/write was async, and you had a simple implementation (like SliceInStream) which returns right away, there'd be no extra overhead?
<andrewrk>
there would be overhead because `return` in an async function does an atomic rmw so that a thread racing for `return` and a thread racing for `await` have the desired effect. however for an async function that has no suspend points, zig could make an optimization to omit that. because it would be impossible for that situation to occur
<andrewrk>
an async function that returns right away has no suspend points
<dbandstra>
ok
<dbandstra>
i guess the optimization wouldn't work if you have a function which just takes a poitner to an std.io.InStream, but then again such a function needs to be written async style anyway
<dbandstra>
if you don't see anything wrong with the "extern" then i'll keep trying myself to diagnose it
<andrewrk>
dbandstra, it looks fine to me. it seems most likely to be an SDL API thing
<dbandstra>
ok
<dbandstra>
i'll have to do a c equivalent of this and see if that works
<andrewrk>
bummer
<dbandstra>
i was using SDL_Mixer formerly, but now i want to do a custom mixer
<andrewrk>
is there perhaps an error log that you are not seeing that can be enabled?
<dbandstra>
not that i know of
<andrewrk>
if you're not getting a segfault, it seems extremely unlikely to me that there is a zig compiler bug causing a function to not get called
<andrewrk>
but your code does look correct too
<dbandstra>
all i know is i hear no sound, std.debug.warn in the callback does nothing, nor does @panic
<dbandstra>
c version seems silent too, i'm doing something stupid :p
<andrewrk>
I apologize for the fact that I am relieved :)
<dbandstra>
hehe
<dbandstra>
i'm also glad that nothing's wrong with zig here
<dbandstra>
the problem: i was using SDL_OpenAudioDevice (new fangled api) instead of SDL_OpenAudio, and should have been using SDL_PauseAudioDevice instead of SDL_PauseAudio
<andrewrk>
ah. I remember that now. apologies for not spotting it
<andrewrk>
(that said, it's a shame the SDL API couldn't catch it too)
<andrewrk>
I think the concept of "debug mode runtime checks" is under-valued
<dbandstra>
this is kind of spooky actually, SDL_OpenAudio returns device ID 1, where SDL_OpenAudioDevice (with device name = NULL) returns ID 2
<dbandstra>
if those are actualyl different devices, then this bug only manifested because of my hardware config
<dbandstra>
SDL_PauseAudio(x) just runs SDL_PauseAudioDevice(1, x)
<Hejsil>
andrewrk, I'm finding a handful of syntactic ambiguities: fn(comptime a: {}) void (comptime param or comptime labeld block?)
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Hejsil has quit [Quit: Page closed]
davr0s has joined #zig
wilsonk has joined #zig
<MajorLag>
Can anyone tell me if bitfields in Zig begin at LSB always or if it is machine endianess dependant? My guess is that it relies on LLVM for this and that LLVM uses MSB on big endian, but I am having trouble verifying.
return0xe has joined #zig
return0e has quit [Read error: Connection reset by peer]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
darithorn has joined #zig
Ichorio has joined #zig
<andrewrk>
MajorLag, machine endianness dependant
<MajorLag>
Thanks, now I think I know enough to add arbitrary packed struct reading w/ endian correcting.
very-mediocre has quit [Quit: Page closed]
commande1 has joined #zig
darithorn has quit [*.net *.split]
allan0 has quit [*.net *.split]
so has quit [*.net *.split]
commander has quit [*.net *.split]
so has joined #zig
jjido has joined #zig
jjido has quit [Ping timeout: 268 seconds]
jjido has joined #zig
jjido has quit [Ping timeout: 246 seconds]
Jenz has joined #zig
Jenz has quit [Quit: 'Night']
nornagon has quit [Quit: Ping timeout (120 seconds)]
Ichorio has quit [Ping timeout: 240 seconds]
m4ge123 has joined #zig
jjido has joined #zig
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jjido has quit [Remote host closed the connection]