ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
Ichorio has quit [Ping timeout: 240 seconds]
fsateler has quit [Read error: Connection reset by peer]
fsateler has joined #zig
Flaminator has joined #zig
wink_ has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
jevinski_ has joined #zig
jevinskie has quit [Ping timeout: 268 seconds]
redj has quit [Ping timeout: 268 seconds]
redj has joined #zig
darithorn has quit [Quit: Leaving]
darithorn_ has joined #zig
darithorn_ has quit [Remote host closed the connection]
noonien has quit [Quit: Connection closed for inactivity]
wilsonk has quit [Read error: No route to host]
wilsonk has joined #zig
_whitelogger has joined #zig
MajorLag has quit [Read error: Connection reset by peer]
MajorLag has joined #zig
emekoi has joined #zig
emekankurumeh[m] has joined #zig
emekoi has quit [Client Quit]
kristate has quit [Remote host closed the connection]
kristate has joined #zig
kristate has quit [Remote host closed the connection]
kristate has joined #zig
kristate has quit [Remote host closed the connection]
kristate has joined #zig
_whitelogger has joined #zig
Ichorio has joined #zig
Zaab1t has joined #zig
fsateler has quit [Read error: Connection reset by peer]
fsateler has joined #zig
wootehfoot has joined #zig
Zaab1t has quit [Ping timeout: 246 seconds]
return0e has quit [Ping timeout: 272 seconds]
return0e has joined #zig
schme245 has joined #zig
<schme245> yo! new Zig user here, just started playing around with it yesterday, having lots of fun so far :D
<schme245> one thing that has me stumped so far: when I try to compile this code
<schme245> const Player = enum {
<schme245> Cross,
<schme245> Circle,
<schme245> fn asInt(player: Player) i32 {
<schme245> return switch (player) {
<schme245> Player.Cross => -1,
<schme245> Player.Circle => -1,
<schme245> };
<schme245> }
<schme245> };
<schme245> /zig/tictactoe/tictactoe.zig:14:16: error: unable to infer expression type
<schme245> return switch (player) {
<schme245> I get this error ^
<schme245> I've tried to add some casts and whatnot but to no avail, does anyone know how to make it work?
forgot-password has joined #zig
<forgot-password> Is there a way to express that my functions accepts a slice or an array, without the use of var?
forgot-password has quit [Ping timeout: 268 seconds]
forgot-password has joined #zig
<donpdonp> schme245: perhaps the return values of the difference cases in the switch are different?
<schme245> well, one arm returns -1, the other 1, and the function returns i32, so it seems to me that the compiler should be able to figure it out
<donpdonp> oh i didnt see the switch was in your paste.
<donpdonp> a function as an enum value? thats new to me
forgot-password has quit [Ping timeout: 272 seconds]
forgot-password has joined #zig
hooo has joined #zig
<schme245> it's pretty neat! it just namedspaces the function so you can call it as `Player.asInt(...)`
MajorLag has quit [Ping timeout: 250 seconds]
MajorLag has joined #zig
Zaab1t has joined #zig
return0e has quit [Ping timeout: 244 seconds]
return0e has joined #zig
noonien has joined #zig
noonien has quit [Client Quit]
kristate has quit [Remote host closed the connection]
forgot-password has quit [Quit: leaving]
<Flaminator> Schme245 you can use @intCast(i32, -1) or define the values using const one: i32 = 1; const minus_one: i32 = -1; The compiler probably sees the -1 in your code as a comptime_int instead of an i32.
<schme245> Flaminator: ahh, that explains it, thanks!
<Flaminator> Pretty sure both of those ways aren't the way it should work though.
<emekankurumeh[m]> forgot-password: if you are using the latest version of zig, you can just say it accepts a slice and when you need to pass an array just take the address of it. [here's](https://godbolt.org/z/-gg18W) an example.
kristate has joined #zig
kristate has quit [Ping timeout: 245 seconds]
schme245 has quit [Remote host closed the connection]
<emekankurumeh[m]> schme245: have you tried [this](https://godbolt.org/z/fVae6z)?
schme245 has joined #zig
<wilsonk> emekankurumeh[m]: you forgot the squiggly braces inside the warn statements double quotes on lines 16 and 17 in your godbolt example ;). (and probably some '\n's also)
<emekankurumeh[m]> whoops
kristate has joined #zig
kristate has quit [Remote host closed the connection]
schme245 has quit [Remote host closed the connection]
Flaminator has quit [Disconnected by services]
wootehfoot has quit [Ping timeout: 240 seconds]
Zaab1t has quit [Quit: bye bye friends]
porky11 has joined #zig
<porky11> does zig support some type of compile time lists?
<porky11> I want to do something like that: fn Multivector(comptime C: usize, comptime B: [C]u32, comptime T: type) type { return struct... }
Ichorio has quit [Ping timeout: 240 seconds]
avila has joined #zig
schme245 has joined #zig
kristate has joined #zig
kristate has quit [Ping timeout: 246 seconds]
hooo has quit [Quit: Connection closed for inactivity]
avila has quit [Ping timeout: 268 seconds]
kristate has joined #zig