ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
mahmudov has joined #zig
kristate has joined #zig
kristate has quit [Remote host closed the connection]
<GitHub7>
zig/master 3bb00ea Andrew Kelley: self-hosted: implement getAppDataDir for windows
v1zix has quit [Ping timeout: 252 seconds]
dbandstra has joined #zig
darithorn has quit [Quit: Leaving]
darithorn has joined #zig
donlzx has joined #zig
darithorn has quit [Remote host closed the connection]
xtreak has joined #zig
mahmudov has quit [Remote host closed the connection]
<dbandstra>
why is it not possible to compare `?T` to `T`? i saw the issue that was resolved a couple days ago but it was only for pointers
<dbandstra>
if it compiles down to two comparisons i don't see why that's a problem
<dbandstra>
my example: `if (if (transparent_color_index) |t| t == index else false) {` (thanks to thejoshwolfe for the crazy if-in-if idea)
<dbandstra>
i'm not sure if there was an argument against it (the non-pointer case) or if it kind of got missed
<dbandstra>
`if ((transparent_color_index orelse ~index) == index)` is cuter for my situation ... forgot about this operator. but this wouldn't work for e.g. floats
hio has joined #zig
kristate has quit [Remote host closed the connection]
kristate has joined #zig
v1zix has joined #zig
jjido has joined #zig
kristate has quit [Remote host closed the connection]
hio has quit []
kristate has joined #zig
donlzx has quit [Remote host closed the connection]
v1zix has quit [Ping timeout: 252 seconds]
jjido has quit [Ping timeout: 244 seconds]
unique_id has joined #zig
dbandstra has quit [Quit: Leaving]
ffnode has joined #zig
jjido has joined #zig
jjido has quit [Read error: Connection reset by peer]
jjido has joined #zig
<GitHub191>
[zig] kristate opened pull request #1255: Revert removal of IR dead code (master...issue1249) https://git.io/fN3aF
jjido has quit [Ping timeout: 240 seconds]
kristate has quit [Remote host closed the connection]
kristate has joined #zig
kristate has quit [Remote host closed the connection]
kristate has joined #zig
Avinash has joined #zig
Avinash_ has joined #zig
kristate has quit [Remote host closed the connection]
kristate has joined #zig
Avinash has quit [Ping timeout: 264 seconds]
lmb_ has joined #zig
<lmb_>
hello, i just started noodling around with zig, and have a question re "comptime return types". i have a fn (comptime a, comptime data: []const u8) []const u8. if i try to assign the result of that to a comptime const I get a compiler error. am I missing something or is this not supported by zig?
Avinash_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xtreak has quit [Remote host closed the connection]
donlzx has joined #zig
davr0s has joined #zig
tiehuis has joined #zig
<tiehuis>
lmb_: that should be fine, could you post the full example?
<tiehuis>
the compile-time evaluation part of zig usually has the largest share of bugs so it is possible that there is could be an issue there
<tiehuis>
main intention here is to better convery single-item pointer types, nullable types and untranslatable macros
<tiehuis>
it's a fairly quick pass so there are probably issues but feel free to make any prs
<tiehuis>
@cImport works pretty well as is for small examples right now, so it isn't that required, but it may be helpful if you want to be more heavily dependent
<lmb_>
the idea is to build testcases for a parser at compile time
<tiehuis>
can you try `const data = comptime makeToken` instead of `comptime const data = makeToken`
xtreak has joined #zig
<lmb_>
yup
<tiehuis>
that work okay?
<lmb_>
yeah, it compiles!
<lmb_>
cheers
<lmb_>
comptime errors could use some love, but then i'm guessing there is an issue for that already :D
<tiehuis>
awesome! i don't know the reason why that first one doesn't work at the momemnt but generally putting comptime on the function call is preferable
<tiehuis>
to needing it on a const
<lmb_>
ok
<tiehuis>
you shouldn't ever need it on a const decl as far as i can think
<lmb_>
it wasn't entirely clear at which points i can slap it
<lmb_>
so i just put it in a few places where it seemed reasonable
<tiehuis>
i believe that initial wya doesn't work because it won't execute makeToken at comptime by default and
<tiehuis>
comptime on the left side doesn't act as a single block like one may otherwise expect
<tiehuis>
e.g. `comptime { const data = makeToken(...); }`
<lmb_>
i kind of expected the compiler to implicitly make the return value of makeToken comptime
<lmb_>
ah
<lmb_>
so `comptime makeToken` is just a comptime block with a single statement in it?
<tiehuis>
yeah, i think thats doable, and the compiler should try to execute the rhs at comptime whenever the lhs is explicitly comptime
<tiehuis>
you can think of it like that probably, yeah
<lmb_>
ok, thanks for the help
<lmb_>
coming from a Go background, zig is pretty easy to pick up
<lmb_>
and so far its fun
<lmb_>
so thanks for working on it!
<tiehuis>
no problem
<tiehuis>
that's good to hear! feel free to ask any more questions if any other issues come up
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<unique_id>
well, I'm having some eye strain issues atm. That means limiting computer use to programming only. Signing out.
unique_id has left #zig ["Konversation terminated!"]
lmb_ has quit [Quit: Page closed]
kristate has quit [Ping timeout: 256 seconds]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jjido has joined #zig
donlzx has quit [Remote host closed the connection]
donlzx has joined #zig
donlzx has quit [Remote host closed the connection]
ffnode has joined #zig
davr0s has joined #zig
Richard10 has joined #zig
Richard10 has quit [Client Quit]
xtreak has quit [Remote host closed the connection]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
Ichorio has joined #zig
very-mediocre has quit [Ping timeout: 252 seconds]
<andrewrk>
dbandstra, I could answer the question for more specific cases - but for example we already don't support == for structs, so if the optional type had a struct as a child type, that wouldn't work
<GitHub97>
[zig] andrewrk closed pull request #1255: Revert removal of IR dead code (master...issue1249) https://git.io/fN3aF
<GitHub66>
zig/master a9ab528 Andrew Kelley: std.event.Loop.onNextTick dispatches work to waiting threads
<lmb>
ok, thanks
<wilsonk>
any idea why doing 'zig build' with a pretty much empty build.zig file (just a dummy build function) gives a ton of 'duplicate struct field' errors?
<wilsonk>
zig-cache has all the builtin code copied into it and that is the source of all the duplicate fields?
<andrewrk>
wilsonk, I'd be happy to help. can you paste the file somewhere and link it?
<andrewrk>
I tried just now to reproduce the issue unsuccessfully
<wilsonk>
am I not supposed to pass in the Builder?
<andrewrk>
/home/andy/tmp/build.zig:1:18: error: use of undeclared identifier 'Builder'
<andrewrk>
that's what I get. are you using a master build? you're using the old pointer syntax
<wilsonk>
yeah, I just saw that and changed it
<wilsonk>
weird that I don't get the undeclared identifier error
<wilsonk>
ah, nvm...I see what I did
<andrewrk>
what was it?
<wilsonk>
just wasn't using '--build-file'
<andrewrk>
so it was looking at build.zig in the current working directory
<wilsonk>
yes
<wilsonk>
so it seems like 'zig build' fails even with a build.zig file in the cwd but 'zig build --build-file build.zig' doesn't produce any errors about duplicate symbols? (I just pulled the newest repo and built one minute ago, btw)
Tobba has quit [Read error: Connection reset by peer]
<andrewrk>
I'd be happy to help if you provide a paste
tobbez has quit [Ping timeout: 245 seconds]
<wilsonk>
Oh, that is fine...it is working now if I just supply the --build-file arg. No problems
<andrewrk>
that's not a known issue and I'm unable to reproduce it
<wilsonk>
whoa, weird...now it is working with just the regular 'zig build' command? Not sure what happened before...it was trying to include 'builtin' twice or something? Weird
Bas_ has quit [Ping timeout: 252 seconds]
<wilsonk>
what does the ?? operator do? Test an optional for null?
<andrewrk>
there is no ?? operator
<wilsonk>
oh, there used to be one...yes? Was it changed to something else?