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/
shritesh has joined #zig
<shritesh> bketelsen: I went down the WebIDL rabbit hole this weekend. I think we can automatically generate bindings to *all* Web APIs.
<shritesh> I'm personally looking forward to being able to write WebGL in Zig.
return0e has joined #zig
redj has quit [Read error: Connection reset by peer]
return0e has quit []
fengb has joined #zig
return0e has joined #zig
jevinski_ has joined #zig
jevinskie has quit [Ping timeout: 276 seconds]
\u is now known as meowray
scientes has quit [Ping timeout: 246 seconds]
redj has joined #zig
qazo has quit [Ping timeout: 246 seconds]
qazo has joined #zig
_whitelogger has joined #zig
qazo has quit [Ping timeout: 255 seconds]
qazo_ has quit [Ping timeout: 250 seconds]
qazo has joined #zig
marmotini_ has joined #zig
fengb has quit [Ping timeout: 256 seconds]
qazo has quit [Ping timeout: 246 seconds]
marmotini_ has quit [Ping timeout: 250 seconds]
marmotini_ has joined #zig
shritesh_ has joined #zig
marmotini_ has quit [Ping timeout: 246 seconds]
shritesh has quit [Ping timeout: 246 seconds]
dbandstra has joined #zig
<dbandstra> is there any way to construct a union value using metaprogramming?
<dbandstra> like this `ComplexType{ .Ok = 42 };` but where "Ok" comes from a string or something at comptime
<dbandstra> ah the infamous reify...
<dbandstra> well, it's a bit smelly that i'm using unions in the first place. i'll stick to switch statement boilerplate for now and then try to get rid of the unions later. thanks daurnimator
dbandstra has quit [Quit: Leaving]
<hryx> tyler569: I figured out what was making my tests panic whenever there was a parse error. I'ma idjot https://github.com/hryx/zig/commit/2e8d5806c32b35a94bc21ce0a43f20cc7a77c242
Summertime has quit [Quit: Sunsetting.]
Summertime has joined #zig
jjido has joined #zig
edr has quit [Ping timeout: 250 seconds]
<tyler569> haha always the best realizations
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
edr has joined #zig
hio has joined #zig
<hryx> sure are! Welp, the floodgates are open now. went from 0 passing tests to 10 so far /(°o°)\
<tyler569> \o/
ltriant has quit [Quit: leaving]
hio has quit []
hio has joined #zig
neceve has joined #zig
neceve has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
neceve has joined #zig
return0e_ has joined #zig
return0e has quit [Ping timeout: 250 seconds]
_whitelogger has joined #zig
marmotini_ has joined #zig
wilsonk has quit [Ping timeout: 255 seconds]
neceve has quit [Remote host closed the connection]
jevinski_ has quit [Ping timeout: 246 seconds]
jevinskie has joined #zig
halo has joined #zig
jevinskie has quit [Ping timeout: 255 seconds]
jevinskie has joined #zig
wilsonk|2 has joined #zig
neceve has joined #zig
scientes has joined #zig
marmotini_ has quit [Ping timeout: 255 seconds]
very-mediocre has joined #zig
jevinski_ has joined #zig
jevinskie has quit [Ping timeout: 245 seconds]
very-mediocre has quit [Ping timeout: 256 seconds]
very-mediocre has joined #zig
jevinski_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<andrewrk> alright, crazy week is over, back to a normal schedule for me
<andrewrk> I'm going to start with these pull requests
<halo> :D
<shritesh_> This is in the front page of HN: http://way-cooler.org/blog/2019/04/29/rewriting-way-cooler-in-c.html I think Zig would be the perfect language for this use case.
<andrewrk> 11,000 lines of rust replaced with @cImport
<shritesh_> andrewrk: Would it make sense to generate Zig function signatures like @cImport does at compile time using the build system? I'm trying to create bindings for Web APIs from WebIDL. Has this use case been considered or are there any example of something like this?
<andrewrk> I think it's fair to say that some use cases call for code generation. And I think the best place for that to happen is at the build system level yes
<shritesh_> Alright. Chrome is currently experimenting with WASM host bindings where WASM can directly talk to the browser without going through JS. They did a writeup on WebGL and it was like 5x faster. I think this is a better route to prepare for. Zig can really shine when the feature lands in all the browsers.
wootehfoot has joined #zig
<andrewrk> that seems like the obvious endgame for wasm in the browser
<emekankurumeh[m]> sounds like the equivalent of syscalls for wasm
<donpdonp> im trying to call pub extern fn pipe(__pipedes: [*c]c_int) c_int; but i dont know how to declare a variable that satisfies the parameter.
<donpdonp> can someone give an example? ive tried 5 different ways and failed
rivten has joined #zig
<andrewrk> donpdonp, it wants a pointer to an array of 2 c_ints
<andrewrk> right? isn't that what pipe wants?
<donpdonp> yes thats right
<donpdonp> i just dont know how to tell zig that with the compiler scolding me :)
<donpdonp> with/without
<andrewrk> var fds: [2]c_int = undefined; const rc = pipe(&fds);
<donpdonp> thx!
<andrewrk> np
<donpdonp> var fds: [2]c_int = undefined; c.pipe(fds); => error: expected type '[*c]c_int', found '[2]c_int'
<donpdonp> whoops missed an &
<donpdonp> but still get an error.
jjido_ has joined #zig
<donpdonp> c.pipe(&fds); => error: expected type '[*c]c_int', found '*[2]c_int'
<donpdonp> (this is the linux pipe() system call. it fills the int array with two file descriptors)
<andrewrk> donpdonp, that's a bug, I can fix that real quick
jjido_ has quit [Client Quit]
<andrewrk> [*c] is supposed to let you cast from anything: https://ziglang.org/documentation/master/#C-Pointers
<donpdonp> i see.
<donpdonp> im using 0.4.0+98fa065d by the way
<donpdonp> looks like i can use this in the interim: var fds = try allocator.alloc(c_int, 2);c.pipe(fds.ptr);
<tgschultz> you should be able to avoid avoid the allocation: var fds: [2]c_int = undefined; const fds_ptr = @ptrCast([*c]c_int, &fds); c.pipe(fds_ptr);
companion_cube has joined #zig
neceve has quit [Remote host closed the connection]
qazo has joined #zig
Ichorio has joined #zig
jjido has joined #zig
suirad has quit [Ping timeout: 256 seconds]
fengb has joined #zig
very-mediocre has quit [Quit: Page closed]
Ichorio has quit [Ping timeout: 245 seconds]
Ichorio has joined #zig
rivten has quit [Remote host closed the connection]
fengb has quit [Quit: Page closed]
halo has quit [Quit: WeeChat 2.4]
<andrewrk> donpdonp, ^ yes, the bug is that you need that @ptrCast
qazo has quit [Read error: Connection reset by peer]
<donpdonp> got it. thx.
wootehfoot has quit [Read error: Connection reset by peer]
qazo has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ichorio has quit [Ping timeout: 245 seconds]
ltriant has joined #zig
fengb has joined #zig
<fengb> andrewrk: should I adapt https://github.com/ziglang/zig/pull/2336 to use the ABI only? I'm also happy to close it and start afresh since I learned a bunch through the process
<andrewrk> fengb, up to you. I think I'll take responsibility of setting up the libc side of things though. Lots can go wrong and I want to pay close attention
<andrewrk> I mean as far as the .h files and building libc.a from source
<fengb> Sure
<fengb> I'll take a look at just the C ABI then
_whitelogger has joined #zig
fengb has quit [Ping timeout: 256 seconds]