ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
_whitelogger has joined #zig
steveno has joined #zig
steveno has quit [Remote host closed the connection]
steveno has joined #zig
SimonNa has quit [Remote host closed the connection]
SimonNa has joined #zig
darithorn has quit [Quit: Leaving]
steveno has quit [Quit: Leaving]
darithorn has joined #zig
steveno has joined #zig
qazo has quit [Read error: Connection reset by peer]
qazo has joined #zig
darithorn has quit [Ping timeout: 250 seconds]
darithorn has joined #zig
Marumoto has quit [Ping timeout: 240 seconds]
hooo has quit [Quit: Connection closed for inactivity]
steveno has quit [Remote host closed the connection]
kristate has joined #zig
darithorn has quit [Quit: Leaving]
emekoi has joined #zig
emekoi has quit [Ping timeout: 245 seconds]
kristate has quit [Read error: Connection reset by peer]
kristate_ has joined #zig
steveno has joined #zig
steveno has quit [Ping timeout: 240 seconds]
steveno has joined #zig
steveno has quit [Ping timeout: 240 seconds]
halosghost has joined #zig
steveno has joined #zig
noonien has quit [Ping timeout: 252 seconds]
darithorn has joined #zig
noonien has joined #zig
<kristate_> Hejsil and I are working on Zig live here: https://www.twitch.tv/findyourownpath/
kristate_ is now known as kristate
steveno has quit [Ping timeout: 240 seconds]
steveno has joined #zig
steveno has quit [Ping timeout: 240 seconds]
Ichorio has joined #zig
wootehfoot has joined #zig
steveno has joined #zig
steveno_ has joined #zig
steveno has quit [Ping timeout: 268 seconds]
steveno_ has quit [Ping timeout: 240 seconds]
steveno_ has joined #zig
donpdonp has joined #zig
<donpdonp> anyone used zig's webasm target?
<donpdonp> im trying to build a simple hello world but the resulting .wasm (when decompiled to wast) has just one function - (func $panic (type $0)
<donpdonp> though the .zig file has pub fn hello()
<kristate> try exporting it
<kristate> donpdonp: try exporting it
<donpdonp> i swear i tried that before. just tried again and hey something is in the .wast.
<donpdonp> thx kristate
<kristate> donpdonp: you're welcome donpdonp
<kristate> donpdonp: we're hacking on zig/zen right now on twitch
<donpdonp> ha.
<donpdonp> i'll take a look.
<donpdonp> are you the one eating pizza?
steveno_ has quit [Quit: Leaving]
<kristate> donpdonp: yes :-)
<donpdonp> export fn xzoomret() [8]u8 {} ; zig build-lib --strip --target-arch wasm32 => TODO implement C ABI for this architecture. See https://github.com/ziglang/zig/issues/1481
<donpdonp> export fn xzoomret() u8 {}; works fine for a simpler return value. that was the difference.
<kristate> donpdonp: okay, I will implement it
<donpdonp> is there a way to return a string value without hitting this missing feature?
<Flaminator> If I pass a struct to a function by value at what point does Zig decide to pass it by reference instead?
Hejsil has joined #zig
<Hejsil> Flaminator, It's an optimization, so there is no clear semantic for it
<Hejsil> Right now, Zig always pass structs by ref behind your back
<Hejsil> I think
<kristate> donpdonp: the calling convention for export is c abi, so you must return a c_abi objectg
<donpdonp> so []u8 is the right type to return in this case?
<kristate> [*]u8
* donpdonp is still learning zig ptr foo
<Flaminator> Yeah just noticed that just can't change things on a struct you passed to a function by value because it's constant. So need to create a copy of it in the function itself.
<donpdonp> wow! i see a string in the wast.
* donpdonp claps
<Hejsil> Yep, or pass it by mutable pointer :)
<donpdonp> export fn xzoomret() [*]const u8 { return c"zig main"; } => (data $3 (i32.const 8) "zig main\00") (func $xzoomret (type $1) ... return 8)
<donpdonp> where 8 is the offset into the webabm block-of-ram.
<donpdonp> way cool.
<donpdonp> webabm/webasm
<kristate> donpdonp: cool
_whitelogger has joined #zig
wootehfoot has quit [Quit: Leaving]
wootehfoot has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
JinShil has joined #zig
<JinShil> Hello. Can anyone tell me where in the source code comptime expressions are executed? Is there a JIT, VM, how (in general) does it work?
<kristate> JinShil: think of it like mapreduce
<kristate> we are maping instructions to ZigIR and then from ZigIR reducing down to constants or actual LLVM IR
<kristate> heavy lifting is done in src/ir.cpp
<JinShil> kristate, Thanks. I see several `ir_eval*` and `eval` implementations in ir.cpp. I suspect that's where magic is.
<kristate> no magic, just love and code
<JinShil> :)
<kristate> JinShil: oh, and a ton of switch statements
<halosghost> mmmmm switch statements
halosghost has quit [Quit: WeeChat 2.3]
JinShil has quit [Quit: Leaving]
Flaminator has quit [Disconnected by services]
steveno has joined #zig
Hejsil has quit [Quit: Page closed]
emekoi has joined #zig
darithorn has quit [Quit: Leaving]