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/
<dominikh> semi-related, I was wondering about the viability of this approach: instead of using @cImport, manually use translate-c, and then modify the output to clean it up – more idiomatic type names, adding methods, changing C pointers to the appropriate Zig pointers.
ur5us has joined #zig
johnburton has quit [Ping timeout: 256 seconds]
johnburton has joined #zig
<g-w1> I just tried this, I think this works: `extern fn foo(bar: u32) u32; const baz = foo; baz(bar);`
dbandstra has joined #zig
a92 has joined #zig
ur5us_ has joined #zig
ur5us has quit [Ping timeout: 264 seconds]
<dominikh> oh that's neat
geert_ has joined #zig
dpdp has joined #zig
geert_ has quit [Ping timeout: 268 seconds]
<dpdp> im calling var value_tree = try json_parser.parse(json); and trying to figure out which json type value_tree.root is.
<dpdp> every attempt at using @TypeOf and/or @Tagtype has failed. can someone point me in the right direction
<dpdp> (using zig HEAD as of a month or two ago, so newer than 0.6)
<dpdp> the most recent attemtp being "if (@TypeOf(value_tree.root) == std.json.Value.Array) {" => incompatible types: 'type' and '@TagType(std.json.Value)'
<a92> How did these attempts fail? Was there an error message?
<g-w1> i think this is the error: incompatible types: 'type' and '@TagType(std.json.Value)'
<g-w1> dpdp: are you using the standard library json parser?
<dpdp> yup. var json_parser = std.json.Parser.init(allocator, false);
<dbandstra> `if (value_tree.root == .Array)` should work
<g-w1> It is just an enum so u can just match the tags
<dbandstra> or `switch (value_tree.root) { .Array => |x| { ... `
<dpdp> dbandstra: if ... == .Array worked. thanks! I was banging my head agaist that for a long time
<dpdp> not sure why std.json.Value.Array wouldnt be equivalent
<dpdp> hmm actually that does seem to be equivalent o^O
<dbandstra> that should work too
<dbandstra> but you don't use TypeOf because you're actually trying to look at the runtime value of `value_tree.root`
<dpdp> laptop battery almost dead. goota run. thx for the help.
dpdp has quit [Quit: leaving]
<andrewrk> I think the macos regression (causing failing CI) is fixed with my latest commit
frmdstryr has quit [Ping timeout: 240 seconds]
<g-w1> Just out of curiousity, how much longer does that make it take?
xackus_ has quit [Ping timeout: 260 seconds]
ur5us__ has joined #zig
ur5us_ has quit [Ping timeout: 240 seconds]
xackus_ has joined #zig
a92 has quit [Quit: Leaving]
l1x has quit [Ping timeout: 260 seconds]
strmpnk has quit [Read error: Connection reset by peer]
nikki93 has quit [Read error: Connection reset by peer]
nikki93 has joined #zig
strmpnk has joined #zig
l1x has joined #zig
dputtick has quit [Ping timeout: 260 seconds]
dputtick has joined #zig
earnestly has quit [Ping timeout: 256 seconds]
CmdrCrisp has quit [Ping timeout: 264 seconds]
stripedpajamas has joined #zig
stripedpajamas has quit [Read error: Connection reset by peer]
dbandstra has quit [Quit: leaving]
CodeSpelunker has joined #zig
rx_ has joined #zig
rx_ has quit [Quit: rx_]
kristoff_it1 has quit [Ping timeout: 240 seconds]
xackus has joined #zig
xackus_ has quit [Ping timeout: 240 seconds]
ur5us__ has quit [Ping timeout: 264 seconds]
CodeSpelunker has quit [Quit: CodeSpelunker]
dbandstra has joined #zig
xackus has quit [Read error: Connection reset by peer]
xackus has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
<pjz> x
waleee-cl has quit [Quit: Connection closed for inactivity]
mm4 has joined #zig
mm4 has quit [Remote host closed the connection]
geert_ has joined #zig
geert_ has quit [Read error: Connection reset by peer]
Patrice_ has quit [Ping timeout: 258 seconds]
geert_ has joined #zig
frett27__ has quit [Read error: Connection reset by peer]
frett27 has joined #zig
frett27 has quit [Remote host closed the connection]
frett27 has joined #zig
osa1 has joined #zig
frett27 has quit [Ping timeout: 268 seconds]
cole-h has quit [Ping timeout: 240 seconds]
wilsonk has left #zig [#zig]
osa1 has quit [Remote host closed the connection]
osa1 has joined #zig
lucid_0x80 has joined #zig
dead10cc has joined #zig
dead10cc has left #zig [#zig]
x2C25 has quit [Ping timeout: 260 seconds]
dbandstra has quit [Quit: leaving]
Kingsquee has quit []
x2C25 has joined #zig
Kingsquee has joined #zig
Kingsquee has quit []
wilsonk has joined #zig
wilsonk is now known as Guest52885
Guest52885 has left #zig [#zig]
frett27 has joined #zig
frett27 has quit [Quit: Leaving]
xackus has quit [Read error: Connection reset by peer]
xackus has joined #zig
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
xackus has quit [Quit: Leaving]
mmohammadi9812 has quit [Ping timeout: 264 seconds]
mmohammadi9812 has joined #zig
gazler has joined #zig
gazler_ has quit [Ping timeout: 260 seconds]
xackus has joined #zig
<ask6155> hello
<alexnask[m]> hi
<ask6155> there is a function which needs two *ints (x,y) so it can put values into it. so I decided to make a zig struct called vec2. it had two fields x,y both as c_int... what should I pass to the function?
<ask6155> do I pass the struct.x or *struct.x?
xackus has quit [Quit: Leaving]
xackus has joined #zig
benjamin-l has quit [Ping timeout: 240 seconds]
dutchie has quit [Ping timeout: 240 seconds]
dutchie_ has joined #zig
dutchie_ is now known as dutchie
<alexnask[m]> ask6155: If the function takes *int, you should pass &struct.x
<ask6155> okay it works now, thanks
benjamin-l has joined #zig
jjsullivan has quit [Ping timeout: 260 seconds]
earnestly has joined #zig
mmohammadi9812 has quit [Ping timeout: 264 seconds]
mmohammadi9812 has joined #zig
mmohammadi9812 has quit [Ping timeout: 246 seconds]
mmohammadi9812 has joined #zig
frmdstryr has joined #zig
Kena has joined #zig
<Kena> Hello bits and bytes people. Please what does `unreachable` do in ReleaseSmall mode?
<frmdstryr> No-op
xackus has quit [Ping timeout: 268 seconds]
<Kena> No-op means it has zero cost in time and space, right?
<Kena> 0 bytes allocated and 0 microprocessor cycle use I mean.
<frmdstryr> Not sure, I think it depends on whether the optimizer can remove it completely.
<g-w1> to be sure, you could try it on zig.godbolt.org
<ifreund> Kena: unreachable allows the compiler to generate code as if the given state is truly impossible to reach. This means that there is no code generated for the unreachable statement itself but it allows surrounding codegen to potentially be done more efficiently
<ifreund> if your program does reach this state you told the compiler was unreachable though, that is UB and truely anything could happen
<ifreund> i.e. the best outcome is a crash
kristoff_it1 has joined #zig
bsrd has quit [Quit: WeeChat 2.9]
<frmdstryr> The llvm docs are similarly unclear http://llvm.org/docs/LangRef.html#unreachable-instruction
bsrd has joined #zig
<frmdstryr> gcc's __builtin_unreachable() is more helpful https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
<ifreund> to the contrary, the llvm docs state exactly what it does
<ifreund> It has "no defined sematics" i.e. reaching it is UB
waffle_ethics has joined #zig
<frmdstryr> Saying what it doesn't do isn't what it does :)
<ifreund> well that's the point, what it does is undefined
<Kena> Thank you frmdstryr, g-w1, ifreund
x2C25 has quit [Ping timeout: 268 seconds]
<Kena> By the way g-w1, do you have a degree in software engineering, computer ingineering, computer science or did you learn programming yourself? I'm still impressed that you're developing a compiler.
haliucinas has quit [Remote host closed the connection]
osa1 has quit [Read error: Connection reset by peer]
osa1 has joined #zig
haliucinas has joined #zig
skuzzymiglet has joined #zig
marnix has quit [Ping timeout: 268 seconds]
marnix has joined #zig
waffle_ethics has quit [Ping timeout: 272 seconds]
skuzzymiglet has quit [Read error: No route to host]
waffle_ethics has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
donniewest has joined #zig
cole-h has joined #zig
xackus has joined #zig
skuzzymiglet has joined #zig
Akuli has joined #zig
osa1 has quit [Quit: osa1]
hnOsmium0001 has joined #zig
zippoh has quit [Ping timeout: 260 seconds]
waleee-cl has joined #zig
dumenci has joined #zig
lucid_0x80 has quit [Ping timeout: 264 seconds]
<ifreund> tdeo: just ported my scanner to use your xml parser which is working great. Do you know how best I should handle licensing? ISC is "equivalent" to MIT according to wikipedia but I probably still have to ship two LICENSE files or something
Kena has quit [Remote host closed the connection]
Akuli has quit [Quit: Leaving]
<g-w1> Kena: I have done all my computer science by myself with no formal stuff. But my compiler is not that big. Its just for fun to see how things work.
moinstar has joined #zig
waffle_ethics has quit [Ping timeout: 240 seconds]
waffle_ethics has joined #zig
<Ristovski> Just out of curiosity, is it possible to "serialize" a struct for example (into something like a byte array, for sending via network etc)
<pixelherodev> For sure
<Ristovski> I think I have heard of this on some github issue, maybe even here as well, but I wonder how custom types would be handled
<pixelherodev> Look at what happens with e.g. `std.debug.warn("{}", .{some_struct_instance});`
<pixelherodev> If you define a `pub fn format` in the struct, it'll use that to serialize it, I believe
<Ristovski> Yeah exactly, it seems like it would be fairly 'easy'
<pixelherodev> Check out fmt.zig in the standard library
<Ristovski> Hmm, will do, thanks!
<pixelherodev> :)
<Ristovski> I have some C++ code that uses capnproto for serialization, which I would love to port to Zig with no external deps
<Nypsie[m]> Ristovski: There's also std.serialization that you could check out
<Ristovski> Nypsie[m]: oh huh, how did I miss that? neat
benjamin-l has quit [Ping timeout: 240 seconds]
dumenci has quit [Ping timeout: 240 seconds]
tracernz has quit [Ping timeout: 272 seconds]
tracernz has joined #zig
tane has joined #zig
lucid_0x80 has joined #zig
CmdrCrisp has joined #zig
skuzzymiglet has quit [Ping timeout: 256 seconds]
CmdrCrisp has quit [Ping timeout: 264 seconds]
LanceThePants has quit [Read error: Connection reset by peer]
LanceThePants has joined #zig
<ugla> https://baremessages.org has a zig implementation too
<ugla> Oh, no deps, never mind :)
<companion_cube> although zig serialization is not standard, is it? if you need to talk to other programs it can be a problem
<Ristovski> ugla: Oh nice! Well, "no deps" would just be an extra nice thing to have (or in this case - to not have :P)
geert_ has quit [Ping timeout: 264 seconds]
<andrewrk> latest CI failure on macOS is this message: Assertion failed: (timeout != -1), function uv__io_poll, file ../deps/uv/src/unix/kqueue.c, line 231
<andrewrk> wtf? we have no libuv anywhere in zig or in the ci script
<Ristovski> perhaps in some macos lib?
<g-w1> Why do all the bugs need to be right before the release? :(
<andrewrk> std lib tests do not link any libs other than libSystem
<Ristovski> perhaps libSystem uses libuv then?
<Ristovski> although that would be quite odd
<g-w1> this seems like same assertion error
<g-w1> seems like the wrong darwin version https://github.com/nodejs/node/issues/34633
<ifreund> g-w1: because llvm releases shake them out :P
waffle_ethics has quit [Ping timeout: 256 seconds]
<andrewrk> node.js depends on libuv and zig does not. so this makes no sense
waffle_ethics has joined #zig
<andrewrk> the only thing I can think of is that azure pipelines runs on nodejs or something like that
<g-w1> yeah
<Ristovski> Oh hmm, that could be it
<andrewrk> yep ok that's it
<fengb> Azure CI uses nodejs under the hood?
<g-w1> i think so. lol
scientes_ is now known as scientes
scientes has joined #zig
scientes has quit [Changing host]
<pixelherodev> Shocker.
<g-w1> its actually typescript because microsoft
<andrewrk> all aboard the merge train. CHOO CHOO!
<Nypsie[m]> Chooo choooo
<pixelherodev> Nice! :)
<companion_cube> 🚂🚃🚃🚃🚃🚃
<pixelherodev> Below 40 PRs! We need to send more to fix this!
<pixelherodev> ;)
x2C25 has joined #zig
Kena has joined #zig
<Kena> Regarding to the optional pointer, please why address 0 is more manageable/desirable than null value?
<pixelherodev> What do you mean?
<pixelherodev> For a typical optional pointer, "zero" is technically the value of a null pointer, it's just less blatant than in C
<pixelherodev> (e.g. `= 0` is a compile error in zig)
<Kena> It is a compile error for every types you mean?
<pixelherodev> You can use `allowzero` if you're working on e.g. kernel code
<g-w1> Only for pointers. It is not for integers.
<pixelherodev> ^
<Kena> lol Ok I was afraid for a moment.
<Kena> Thanks both of you :)
<pixelherodev> :)
<pixelherodev> It's one of the small quality-of-life improvements Zig has :)
<Kena> (e.g. `= 0` is a compile error in zig) could be added in the documentation at https://ziglang.org/documentation/master/#Optional-Pointers for noobies like me.
<pixelherodev> I'm a bit busy reviewing a 22K line diff :P
<scientes> Kena, it is here, sort of https://ziglang.org/documentation/master/#allowzero
<g-w1> are null pointers also checked at runtime?
<scientes> g-w1, they are in safe mode
<g-w1> cool
xackus has quit [Ping timeout: 240 seconds]
lucid_0x80 has quit [Ping timeout: 268 seconds]
skuzzymiglet has joined #zig
<Ristovski> Any reason why the std docs website is not updated frequently?
<ikskuh> afaik it's a manual process
<Ristovski> hmm, I see
<Ristovski> it's "master" is still at 0.6.0+204f61d7f
<pixelherodev> Any reason that's not e.g. on a weekly cronjob?
<Ristovski> Yeah, my question exactly
<Ristovski> it's currently 4 months out of date
<Ristovski> which in Zig progress time, is quite a lot
jjsullivan has joined #zig
<Ristovski> andrewrk: Could this be automated? it would be very nice to have up-to-date docs for std
<andrewrk> yes it sure could https://github.com/ziglang/zig/issues/3402
<Ristovski> ideally, it should correspond to the latest master/nightly release
<andrewrk> I bumped it down to 0.7.0 milestone, but no promises that I'll have time to do it by the release - lots of other things to get done too
<scientes> Ristovski, look in the ci folder
<Ristovski> Hmm, is -femit-docs broken on master? `zig test lib/zig/std/std.zig -femit-docs -fno-emit-bin` fails with 'Terminated' after semantic analysis (also --output-dir has been removed)
<Ristovski> Oh actually, that might be caused by earlyoom :/ I assume this might be quite memory-intensive
<Ristovski> Yup, too memory intensive for my measly 8GB of ram
<g-w1> can someone tell me which one of these flags cause the output binary to be in a different place please? /drone/src/build/zig build-exe -cflags -std=c99 -- /drone/src/test/standalone/shared_library/test.c --library /drone/src/test/standalone/shared_library/zig-cache/o/06dd1d74d6beba6ec58d8ec19bc295fc/libmathtest.so.1.0.0 -rpath /drone/src/test/standalone/shared_library/zig-cache/o/06dd1d74d6beba6ec58d8ec19bc295fc
<g-w1> --library c --cache-dir /drone/src/test/standalone/shared_library/zig-cache --name test --enable-cache
<g-w1> my pr is failing because of it and I want to know where the output binary would be, because it is not $pwd/test? https://github.com/ziglang/zig/pull/6716
frett27 has joined #zig
<ifreund> --cache-dir i assume
<g-w1> you think it makes it output to $cache-dir/bin/test?
<ifreund> that would be my guess
ur5us__ has joined #zig
waffle_ethics has quit [Ping timeout: 264 seconds]
skuzzymiglet has quit [Read error: No route to host]
benjamin-l has joined #zig
ur5us__ has quit [Remote host closed the connection]
ur5us__ has joined #zig
frett27 has quit [Ping timeout: 264 seconds]
<Ristovski> Can someone confirm -femit-docs works on latest master? I tried it on a beefier machine and I get 'error: unable to find '{io,fs,os,json,net,linux}/test.zig''
<Ristovski> Or perhaps that is no longer the way to generate the docs
CmdrCrisp has joined #zig
decentpenguin has quit [Read error: Connection reset by peer]
Kingsquee has joined #zig
skuzzymiglet has joined #zig
bgiannan has joined #zig
marnix has quit [Ping timeout: 240 seconds]
Kena has quit [Remote host closed the connection]
decentpenguin has joined #zig
donniewest has quit [Quit: WeeChat 2.9]
nvmd has joined #zig
wilsonk has joined #zig
wilsonk is now known as Guest24505
skuzzymiglet has quit [Ping timeout: 264 seconds]
Guest24505 has quit [Client Quit]
wilsonk_ has joined #zig
wilsonk_ has quit [Client Quit]
wilsonk_ has joined #zig
<wilsonk_> test
<g-w1> hi
<wilsonk_> hey g-w1
wilsonk_ has quit [Quit: Leaving]
wilsonk_ has joined #zig
tane has quit [Quit: Leaving]
<andrewrk> zig 0.7.0 release postponed to 2020-11-07; release party is the next day
ur5us__ has quit [Ping timeout: 264 seconds]
a92 has joined #zig
a92 has quit [Read error: Connection reset by peer]