ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
clownpriest has quit [Quit: Textual IRC Client: www.textualapp.com]
<adrusi> What's the recommended way to do networking in zig? Should I just use libc?
<MajorLag2> Oh man, I can't believe I didn't try this sooner: loading large structs with data from a file using a generic function and @typeInfo. You might think "couldn't you just cast a slice of bytes directly?", but no, not in this case because the file is BE. So much tedious boilerplate just dissappeared.
darithorn has joined #zig
<MajorLag2> @adrusi I think the basic socket handling syscalls might be in the posix portions of the stdlib, at least for linux, but yeah you should probably call C right now.
<adrusi> alright, thanks
<MajorLag2> Andrewrk has been working on getting a basic HTTP server running using the async functionality, but I'm not sure where he's at.
tiehuis has joined #zig
<MajorLag2> On the subject of @typeInfo though, this does raise a question: does @typeInfo report fields in the order they are writen, or in the order they are in memory? IIRC Zig doesn't actually do any struct re-ordering right now, but what should the behavior be?
<andrewrk> adrusi, here's a small example of networking without libc: https://gist.github.com/andrewrk/d48c8c9ca0fb67bf6d7c0bed744d82ce
<andrewrk> it's very W.I.P. at the moment, for now I would recommend libc
<andrewrk> MajorLag2, the order they're declared in, I think
<MajorLag2> oh hey, there's a std.net, I never noticed somehow...
<adrusi> I looked at the source of std.net and it looked like just IP address types
<adrusi> I imagine eventually there will be more than that
<MajorLag2> andrewrk, that's what makes sense to me, though that could just be because it happens to be what I need for this to work like it does.
<MajorLag2> though the fact that it saves me several hundred lines of tedious code seems like a good argument in its favor.
<GitHub160> [zig] andrewrk pushed 1 new commit to master: https://git.io/vhWqh
<GitHub160> zig/master 7b386ea Andrew Kelley: fix build file template...
return0e has joined #zig
quc has joined #zig
cenomla has joined #zig
<adrusi> do compiler segfaults happen often?
<MajorLag2> kinda, yeah. Especially if you're trying to do crazy stuff in comptime.
<MajorLag2> I pretty much only run into them in comptime.
<adrusi> well I don't have any explicit comptime code, but I also have no idea what I'm doing
cenomla has quit [Quit: cenomla]
<MajorLag2> any compiler segfault is a bug, so it should be reported if you can tell what's causing it
<adrusi> OK I've isolated the bug, I'll make an issue
n_1-c_k has quit [Read error: Connection reset by peer]
n_1-c_k has joined #zig
darithorn has quit [Read error: Connection reset by peer]
darithorn_ has joined #zig
aaa_ has joined #zig
aaa_ is now known as Guest55978
<andrewrk> adrusi, thanks for the bug report. I think you can do c_int(c.SOCK_DGRAM)
tiehuis has quit [Quit: WeeChat 2.1]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Guest55978 has quit [Quit: Page closed]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
jjido has joined #zig
dbandstra has quit [Ping timeout: 265 seconds]
<GitHub150> [zig] andrewrk pushed 1 new commit to master: https://git.io/vhWcH
<GitHub150> zig/master f06bce5 Andrew Kelley: introduce [*] for unknown length pointers...
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<GitHub80> [zig] tiehuis pushed 1 new commit to master: https://git.io/vhWWv
<GitHub80> zig/master e514454 Marc Tiehuis: Make zig fmt exit with error on any parse errors...
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
return0e has quit [Ping timeout: 260 seconds]
davr0s has joined #zig
return0e has joined #zig
return0e_ has joined #zig
return0e has quit [Ping timeout: 265 seconds]
return0e has joined #zig
return0e_ has quit [Ping timeout: 256 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
darithorn_ has quit [Ping timeout: 268 seconds]
darithorn_ has joined #zig
davr0s has joined #zig
xenial64-user has joined #zig
xenial64-user has quit [Read error: Connection reset by peer]
cenomla has joined #zig
cenomla has quit [Quit: cenomla]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Ichorio has quit [Ping timeout: 260 seconds]
king_button has joined #zig
davr0s has joined #zig
<king_button> Hi. Can Zig do incremental builds, or are there plans for them like stated in jan 2017 on github? I'd like to build a game that has subsecond recompilation of small changes. I believe this is possible in C if you keep your header dependencies small and controlled.
qazo has joined #zig
s455wang has quit [Quit: WeeChat 1.6]
s455wang has joined #zig
kicking_tires has joined #zig
<king_button> ..but I don't want to have a secondary job as a header hacker, so I guess I'll try this language. I know a compilation from barely nothing does take a full second, but that's fine.
kicking_tires has left #zig ["Leaving"]
king_button has quit [Remote host closed the connection]
king_button has joined #zig
qazo_ has joined #zig
qazo has quit [Read error: Connection reset by peer]
qazo_ is now known as qazo
<andrewrk> king_button, that's planned to be implemented only in the self-hosted compiler, which so far we have a parser, but no codegen
<andrewrk> we don't have fast compilation yet but it will be a primary focus soon
<andrewrk> I'm also thinking about hot code swapping
qazo has quit [Read error: Connection reset by peer]
Ichorio has joined #zig
<n_1-c_k> Could someone help me with my toy program? I managed to get the compile error "cmd-line-args.zig:17:48: error: expected type '?NextError![]u8', found '?NextError![]u8'", https://pastebin.com/YjU5aiga
<andrewrk> n_1-c_k, I'm looking
<n_1-c_k> andrewrk: thanks! It does work if I remove ": ?NextError![]u8", so I guess I should...
<MajorLag2> hmmm... the NextError types are considered different maybe?
<andrewrk> yeah I've been meaning to improve the error message hints for these kind of errors
<n_1-c_k> Is it better to let the type be implicit? I was hoping to be able to tell from the source what type I'm dealing with, if possible?
<MajorLag2> It is more common to leave the type implicit, better is a matter of opinion.
<n_1-c_k> I'd tend to prefer explicit, or is it considered bad style? Is it even possible?
<MajorLag2> Ok, so what happened here is you declared the NextError error set as a different type than the NextError that the iterator returns.
<MajorLag2> try this: const NextError = std.os.ArgIterator.NextError;
<n_1-c_k> MajorLag2: thanks, I shall...
<MajorLag2> NextError is just `error {OutOfMemory};` so `const NextError = error {OutOfMemory};` should also work.
<n_1-c_k> Oh that's better! I wonder, should I have found out that declaration? Is it a matter of going through the stdlib source?
<MajorLag2> but then if we ever change that your code would break
<MajorLag2> yeah, there are no docs for the stdlib yet (should be coming soon via automated doc generation I think), but the stdlib source is pretty easy to read.
<n_1-c_k> MajorLag2: thanks, I'll try to hunt it down.
<andrewrk> n_1-c_k, you can also do @compileLog(@typeOf(foo)) anywhere to find out what type something is
<n_1-c_k> andrewrk: cool, thanks!
<andrewrk> n_1-c_k, if you want to have an explicit error set, you can start by declaring an empty one, and then see what compile errors you get
<n_1-c_k> Ah OK, thanks
<andrewrk> the ? in front is more advanced than the error hinting system can do at the moment, but here I'll show you
<andrewrk> const arg0_q: NextError![]u8 = ??arg_it.next(allocator);
<andrewrk> don't leave it this way, but just for the purpose of compile errors, this will be more helpful
<andrewrk> "note: 'error.OutOfMemory' not a member of destination error set"
<andrewrk> this also shows you the file and line where the error set is declared
<n_1-c_k> So I'd do that after declaring "const NextError = error {};"? I'll try it...
<andrewrk> let me see if I can make the hinting system more advanced
<n_1-c_k> Ah now I see "'error.OutOfMemory' not a member of destination error set"...
<n_1-c_k> ...then I add that to my empty error set and it compiles. Cool!
<andrewrk> (now revert the ?? changes)
quc has quit [Remote host closed the connection]
<n_1-c_k> Oh good point :)
<n_1-c_k> Oh.. now it says "error: expected type 'type', found '?NextError![]u8'"
<n_1-c_k> oops I left a '?', sorry
<n_1-c_k> It compiles, it even runs!
king_button has quit [Remote host closed the connection]
<GitHub84> [zig] andrewrk pushed 1 new commit to master: https://git.io/vhWPX
<GitHub84> zig/master b85b68a Andrew Kelley: better compile error for error sets behind nullable
<andrewrk> n_1-c_k, after this commit ^ your original example has the OutOfMemory compile error hint
<n_1-c_k> andrewrk: wow, I am honoured to have inspired a commit! Thanks!
<andrewrk> thanks for the use case :)
mreiland has joined #zig
jjido has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jjido has joined #zig
jjido has quit [Client Quit]
dbandstra has joined #zig
dixego has joined #zig
dixego has quit [Client Quit]
epsyloN has quit [Quit: ZNC 1.6.3+deb1 - http://znc.in]
atk is now known as Bob
Bob is now known as Guest666
Guest666 is now known as atk
jjido has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jjido has quit [Quit: Textual IRC Client: www.textualapp.com]
darithorn_ has quit [Ping timeout: 265 seconds]
darithorn has joined #zig
return0e has quit [Read error: Connection reset by peer]
Ichorio has quit [Ping timeout: 256 seconds]
return0e has joined #zig
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
king_button has joined #zig
<nicolaslekoala> Is there a reason why there is no iterator for LinkedList?
king_button has quit [Remote host closed the connection]
king_button has joined #zig
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
<mreiland> Hey guys, I'm trying to pick up zig in my spare time and I'm coming across a syntax error I don't understand.
<mreiland> pub fn init(x:f32,y:f32, c: *const Color) Point {