ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
return0e has quit [Remote host closed the connection]
return0e has joined #zig
schme245 has quit [Remote host closed the connection]
<daurnimator> is #3973 ready?
<daurnimator> tests are failing so I guess not
tyler569 has quit [Quit: leaving]
wootehfoot has quit [Read error: Connection reset by peer]
wallyduchamp has quit [Quit: WeeChat 2.5]
doublex has quit [Read error: Connection reset by peer]
doublex has joined #zig
daex has joined #zig
daex_ has quit [Ping timeout: 268 seconds]
charlesshenton has joined #zig
plumm has joined #zig
<plumm> mikdusan: do you know how to use translate-c with -framework?
<daurnimator> andrewrk: license question.... should larger contributions to zig come with an addition to the license file?
dingenskirchen has quit [Ping timeout: 248 seconds]
charlesshenton has quit [Remote host closed the connection]
ky0ko has quit [Ping timeout: 240 seconds]
mahmudov has quit [Ping timeout: 265 seconds]
dddddd has quit [Remote host closed the connection]
marmotini_ has joined #zig
_whitelogger has joined #zig
_whitelogger has joined #zig
mahmudov has joined #zig
plumm has quit [Quit: Lost terminal]
schme245 has joined #zig
schme245 has quit [Remote host closed the connection]
ur5us has joined #zig
marmotin_ has joined #zig
marmotini_ has quit [Read error: Connection reset by peer]
ur5us has quit [Ping timeout: 260 seconds]
_whitelogger has joined #zig
marmotin_ has quit [Remote host closed the connection]
marmotini_ has joined #zig
_whitelogger has joined #zig
Dominic[m] has joined #zig
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
<Dominic[m]> I'm trying to use pulseaudio from zig. I'm trying to do something with https://freedesktop.org/software/pulseaudio/doxygen/volume_8h.html#aded56902e68e0f8ab576339bde55960e which is a uint32_t. I'm returning it from a u32 function. But when I build I get ` expected pointer, found 'u32'` full log at http://sprunge.us/bZUu9u
<Dominic[m]> function is literally `return pulse.PA_VOLUME_NORM`
dingenskirchen has joined #zig
<daurnimator> Dominic[m]: inspect the cimport.zig that gets generated
<Dominic[m]> daurnimator: How can I do that?
<Dominic[m]> There's some in the zig-cache, and I'm certain they'll be identical. But I don't want to assume :)
<daurnimator> Dominic[m]: the path is in your full log
<Dominic[m]> daurnimator: http://sprunge.us/NmKYtA here is cimport.zig. What should I look for?
<daurnimator> Dominic[m]: look at line 2291
<Dominic[m]> Yep. I don't really know what to make of it really.
<Dominic[m]> I'm very new to zig. That line was just voodoo to me.
<daurnimator> Dominic[m]: yeah its pretty ugly to look at... could be cleaned up a lot
<daurnimator> Dominic[m]: so the branch taken is `@intToPtr(pa_volume_t, @as(c_uint, 65536));`
<daurnimator> you can see where the error message comes from now :)
<Dominic[m]> daurnimator: Why would it convert it to a pointer though? That makes no sense to me!
<daurnimator> Dominic[m]: great question!
<daurnimator> I don't know :P
<daurnimator> I wonder if they meant to check the type of pa_volume_t instead of the type of c_uint
schme245 has joined #zig
dingenskirchen has quit [Quit: dingenskirchen]
<daurnimator> Dominic[m]: reading the code, whenever it hits a left paren it assumes the destination type is a pointer.. I'd file an issue
dingenskirchen has joined #zig
schme245 has quit [Remote host closed the connection]
<Dominic[m]> daurnimator: Thanks, I appreciate your help. Do you mind if I link you the issue once it's open so you can comment if I've missed anything?
<daurnimator> Dominic[m]: sure
<daurnimator> Dominic[m]: I'll see it get created in any case
marmotini_ has quit [Remote host closed the connection]
<daurnimator> Dominic[m]: I have a provisional fix for you; just waiting for you to file an issue so I can post the patch ;)
<dch> I don't understand namespaced globals in https://ziglang.org/documentation/master/#Global-Variables
<daurnimator> dch: what don't you understand about them?
<dch> specifically, reading `fn foo() i32 { const S .. }; S.x += 1; ...`
<dch> this reads to me like I'm able to modify const S. I can infer that it allows me to modify the inner var of the struct, but why should this be allowed, and for S to maintain its const-ness?
<daurnimator> dch: note that `S` is a struct; not an *instance* of a struct.
<dch> daurnimator: #facepalm moment thanks!
<dch> so it would be pretty standard for struct definitions to be const, then
<daurnimator> dch: yeah.... though its not the struct that might change, but the type entirely
doublex has quit [Ping timeout: 265 seconds]
<daurnimator> e.g. `var T: type = undefined; inline while (some_condition) { T = struct { inner: T }; } return T;`
return0e has quit [Remote host closed the connection]
<dch> daurnimator: when would it be useful to have a variable type then? I'm not used to that in functional world. type inference would be very unhappy
return0e has joined #zig
<daurnimator> dch: see my example just there: you might be building up a part from pieces.
<daurnimator> or iterating over different types
<daurnimator> dch: what is the type of `T` here? https://github.com/ziglang/zig/blob/master/lib/std/fifo.zig#L418
<daurnimator> andrewrk: around? I'm encountering an issue where zig translate-c just exits the process with code 1
<dch> daurnimator: neat I can see how that's useful, but I'm not yet familiar enough with zig format to read that reliably. inline if supplied type can be fitted into 8 or less bytes.
<daurnimator> dch: huh?
shakesoda has joined #zig
doublex has joined #zig
<Snektron> daurnimator, why does LinearFifo implement 3 different types of allocator
<Snektron> Should that be handled by allocators instead
<daurnimator> Snektron: what do you mean?
<daurnimator> Snektron: 3 different modes: inline buffer; provided buffer; dynamic buffer
<Snektron> I mean that it seems out of place that the LinearBuffer handles allocation, as all functionality can be obtained by building around an allocator instead
<Snektron> .Static is the same as .Dynamic with a FixedBufferAllocator
<Snektron> Not quite maybe, but that feels like the proper direction to me
<daurnimator> Snektron: but then if you want .Static you'd have to wrap it in some higher level struct that had a buffer next to it
<Snektron> Thats the price of abstraction i guess
<Snektron> I would almost argue to make allocators a comptime parameter (similar to how c++ handles them)
<Snektron> Best of both worlds plus possibly better optimization opportunities
<Snektron> Old functionality can be remained by passing *std.mem.Allocator as the allocator type
<Snektron> (That would be similar to c++'s polymorphic memory thingy's)
<daurnimator> Snektron: but with the current code you don't have to pay the price of abstraction; or the overhead of the allocator interface for non-dynamic fifos
<Snektron> Instead you have a type which feels like it implements two things at once
riba has joined #zig
<daurnimator> usage is the same aside from init?
dddddd has joined #zig
marmotini_ has joined #zig
riba has quit [Ping timeout: 258 seconds]
marmotini_ has quit [Ping timeout: 260 seconds]
wootehfoot has joined #zig
_whitelogger has joined #zig
marmotini_ has quit [Remote host closed the connection]
marmotini_ has joined #zig
marmotini_ has quit [Remote host closed the connection]
marmotini_ has joined #zig
marmotini_ has quit [Remote host closed the connection]
<daurnimator> Dominic[m]: ?
doublex has quit [Remote host closed the connection]
doublex has joined #zig
mahmudov has quit [Remote host closed the connection]
mahmudov has joined #zig
<Dominic[m]> daurnimator: Sorry, I've been cooking/cleaning :) Just sat down to do this
<Dominic[m]> daurnimator: In fact, I just found this while searching: https://github.com/ziglang/zig/issues/810 looks _very_ related.
<daurnimator> var i: usize = 0;
<daurnimator> while (i < tree.tokens.len) : (i += 1) {
<daurnimator> const t = tree.tokens.at(i);
<daurnimator> std.debug.warn("RENDER i={} t={}\n", .{ i, t });
<daurnimator> }ah yes
<daurnimator> shit accidently hit paste
<Dominic[m]> haha :) I'll subscribe & follow along.
<Dominic[m]> Zig's C interop is so cool. I can't quite get over it.
<Dominic[m]> I initially went to build this thing in Julia, but the idea of mirroring structs in my code was no fun.
mahmudov has quit [Ping timeout: 240 seconds]
frmdstryr has joined #zig
mahmudov has joined #zig
<mikdusan> plumm: I think we need a patch for `zig cc` to add -framework args
<mikdusan> and this should also address translate-c needs
mahmudov has quit [Remote host closed the connection]
mahmudov has joined #zig
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #zig
<mikdusan> plumm: actually just try and use the `-F` option. clang these days seems to be clever and infers frameworks? anyhow this works for me:
<mikdusan> zig -F/Applications/Xcode_11.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks translate-c foo.c
<mikdusan> where foo.c is: #include <Ruby/ruby.h>
mahmudov has quit [Remote host closed the connection]
mahmudov has joined #zig
schme245 has joined #zig
<Dominic[m]> Is there a naming scheme/strategy used for optional pointers? The docs use the optional_ prefix, but I'm not sure if that's conventional or just for explanation purposes.
doublex has quit [Ping timeout: 260 seconds]
schme245 has quit [Remote host closed the connection]
schme245 has joined #zig
doublex has joined #zig
mahmudov has quit [Remote host closed the connection]
mahmudov has joined #zig
doublex has quit [Ping timeout: 240 seconds]
doublex has joined #zig
doublex has quit [Ping timeout: 268 seconds]
dingenskirchen has quit [Remote host closed the connection]
schme245 has quit [Remote host closed the connection]
dingenskirchen has joined #zig
schme245 has joined #zig
marmotini_ has joined #zig
doublex has joined #zig
marmotini_ has quit [Ping timeout: 260 seconds]
mgxm has quit [Ping timeout: 245 seconds]
mgxm has joined #zig
riba has joined #zig
<Snektron> I usually do opt
MarquisdeFalbala has joined #zig
Akuli has joined #zig
riba has quit [Ping timeout: 260 seconds]
MarquisdeFalbala has quit [Ping timeout: 252 seconds]
marmotini_ has joined #zig
marmotini_ has quit [Remote host closed the connection]
ur5us has joined #zig
MarquisdeFalbala has joined #zig
WendigoJaeger_ has joined #zig
WendigoJaeger_ has quit [Client Quit]
WendigoJaeger has joined #zig
Akuli has quit [Quit: Leaving]
wilsonk has quit [Ping timeout: 265 seconds]
wilsonk has joined #zig
tbodt has left #zig ["Textual IRC Client: www.textualapp.com"]
doublex has quit [Ping timeout: 260 seconds]
doublex has joined #zig
tbodt has joined #zig
doublex_ has joined #zig
doublex has quit [Read error: Connection reset by peer]
ur5us has quit [Ping timeout: 260 seconds]
<andrewrk> daurnimator, thanks for your code reviews lately, they've been quite helpful
ur5us has joined #zig
dingenskirchen has quit [Quit: dingenskirchen]
<daurnimator> andrewrk: just trying to keep things moving :)
dingenskirchen1 has joined #zig
dingenskirchen1 is now known as dingenskirchen
<andrewrk> I'm still visiting family and about to go afk again, but will be back full force tomorrow
mahmudov has quit [Remote host closed the connection]
<hryx> Enjoy the family time!
WendigoJaeger has quit [Quit: Connection closed for inactivity]