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/
<daurnimator> ifreund: "libc doesn't offer a cos() that takes a float" -> what about `cosf`?
<daurnimator> and then there's also tgmath.h
ur5us has quit [Ping timeout: 264 seconds]
marijnfs2 has joined #zig
<marijnfs2> does anyone have opensuse? i have trouble with getting zig to find llvm
mjsir911 has joined #zig
marijnfs2 has quit [Client Quit]
marijnfs2 has joined #zig
<mjsir911> Hello all o/. I need to assert structs(or, easier: tuples) with strings are equal but I can't because strings are pointers and testing compares pointers in structs literally. what can I do?
<marijnfs2> mjsir911: use std.mem.eql
<marijnfs2> there is more in std/mem.zig
<mjsir911> ah, so I need to manually compare every field?
gazler_ has quit [Remote host closed the connection]
gazler_ has joined #zig
<marijnfs2> yeah or you make a comptime function, that's more complicated
<mjsir911> alright, thank you marijnfs2 ! Looking through testing.zig it seems to do array comparisons sometimes, but only with actual .Array types which I think need known lengths at compile time
ur5us has joined #zig
marler8997 has quit [Ping timeout: 272 seconds]
CommunistWolf has quit [Ping timeout: 264 seconds]
ur5us_ has joined #zig
gazler has joined #zig
gazler_ has quit [Read error: Connection reset by peer]
ur5us has quit [Ping timeout: 272 seconds]
CommunistWolf has joined #zig
<g-w1> mem.eql can also do it with slice
<daurnimator> there's also std.meta.eql, but it too doesn't follow pointers
slact has quit [Ping timeout: 272 seconds]
sebonirc has quit [Quit: sebonirc]
<andrewrk> g-w1, have a look at the commit I just pushed
<andrewrk> it's related to optionals/error sets zir/tzir
ur5us_ has quit [Read error: Connection reset by peer]
ur5us_ has joined #zig
<g-w1> yep, im having to rebase a LOT on 7628 rn ;) but at least its unblocked
<g-w1> are there any parts of stage2 that are not prone to merge conflicts?
<g-w1> sooo close to catch at comptime!
marijnfs2 has quit [Quit: WeeChat 3.0]
<andrewrk> g-w1, it's organized pretty decently to avoid conflicts I think - you're dealing with conflicts precisely because we implemented the same thing in different ways
<andrewrk> also the reason I worked on the same thing as you was to help merge your PR - so the conflicts are due to us working together on the same thing. I think it's natural and OK
<andrewrk> s/it's/conflicts are/
<g-w1> ok nice. well 7628 is basically ready for review now. I just need to look it over in the morning and then its ready.
<andrewrk> cool
<andrewrk> hmm it occurred to me that `zig cc` could be doing LTO automatically (or at least make it as simple as -fLTO)
slact has joined #zig
a_chou has joined #zig
<daurnimator> andrewrk: have you had any further thoughts of our discussion after 7638 ?
<andrewrk> no
a_chou has quit [Remote host closed the connection]
ur5us_ has quit [Ping timeout: 260 seconds]
archdria has joined #zig
kameliya[m] has joined #zig
archdria has quit [Quit: Connection closed]
leon-p has joined #zig
jukan has joined #zig
jukan has quit [Quit: leaving]
jukan has joined #zig
sord937 has joined #zig
<mjsir911> whats the point of a while(optional) || {} else {} construct? Isn't this equivalent to code after the while loop?
billzez has joined #zig
<kameliya> when you break; from a while, the else {} doesn't get run.
<mjsir911> Ah, that is useful, ty kameliya !
<mjsir911> not very clear in the manual :P
<kameliya> you can also break with a value. if it doesn't break, the else branch's value is used.
<kameliya> heh, i'm just reading from it :p
<kameliya> check the "rangeHasNumber" example for an example that uses break and else with values.
<mjsir911> You're looking at https://ziglang.org/documentation/master ? is there a better place to use as a reference?
kameliya[m] has left #zig ["User left"]
<kameliya> i am looking at that.
<kameliya> that's a good overall reference
<kameliya> https://ziglearn.org is meant to be good too
kameliya[m] has joined #zig
<mjsir911> ah I see, just needed to look up a bit from the labelled while I was looking at
<kameliya> finally, the source itself for the stdlib (i.e. the parts written in zig) is very readable, when you need to find a function. the autogen'd docs are not superb at the moment.
<kameliya> ahh right
<mjsir911> Yeah I've been having a good time with the source. Thanks a lot!
billzez has quit [Quit: WeeChat 2.8]
<kameliya> great! np!
waleee-cl has quit [Quit: Connection closed for inactivity]
decentpenguin has quit [Quit: ZNC crashed or something]
decentpenguin has joined #zig
tnorth_ has joined #zig
jukan has quit [Ping timeout: 246 seconds]
tane has joined #zig
<tane> howdy
<kameliya[m]> howdy!
frett27_ has joined #zig
<FireFox317> andrewrk, `var opt_val: ?i32 = 10; var val1: i32 = opt_val.?;` does not make it to TZIR. `expected i32, found ?i32`
frett27_ has quit [Ping timeout: 240 seconds]
ur5us_ has joined #zig
midgard_ has quit [Ping timeout: 264 seconds]
midgard has joined #zig
ur5us_ has quit [Quit: Leaving]
<ifreund> daurnimator: even cosf uses doubles internally (at least musl does)
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
slact has quit [Remote host closed the connection]
<tane> is there something like @compileLog that doesn't induce compilation errors?
<FireFox317> tane: `std.debug.print`?
<squeek502> tane, unfortunately not, see https://github.com/ziglang/zig/issues/5469
<tane> I see
<tane> from that discussion I don't get what the future plan is
uael has joined #zig
<FireFox317> tane, i think in the current implementation of stage2 a `compileLog` does not immidiately end analysis, but still continues, so you can have multiple `compileLog`s. But at the end the compiliation will still fail
<tane> yes
<FireFox317> that is better right?
<tane> it's better but still bad
<tane> anyway, I can live with that for now :)
<FireFox317> unfortunately stage2 is still far from finished haha
<uael> hello, I would like to start playing with the sources, does anyone has a shell.nix to share ?
_whitelogger has joined #zig
ky0ko1 has joined #zig
<uael> dutchie working, thanks
v0idify has joined #zig
v0idifyy has quit [Ping timeout: 268 seconds]
riba has quit [Ping timeout: 264 seconds]
uael has quit [Quit: Ping timeout (120 seconds)]
uael has joined #zig
jukan has joined #zig
jukan has quit [Ping timeout: 272 seconds]
ifreund has quit [Ping timeout: 256 seconds]
ifreund has joined #zig
v0idify has quit [Remote host closed the connection]
v0idify has joined #zig
kameliya has quit [Quit: connection reset by purr]
FireFox317 has quit [Ping timeout: 272 seconds]
TheLemonMan has joined #zig
Gliptic has quit [*.net *.split]
casaca has quit [*.net *.split]
cCCCCcccccCCc has quit [*.net *.split]
tines9 has quit [*.net *.split]
yeti has quit [*.net *.split]
dbohdan has quit [*.net *.split]
halbeno has quit [*.net *.split]
bens has quit [*.net *.split]
drewr has quit [*.net *.split]
lohengrin has quit [*.net *.split]
lohengrin has joined #zig
halbeno has joined #zig
dbohdan has joined #zig
bens has joined #zig
Gliptic has joined #zig
yeti has joined #zig
tines9_ has joined #zig
drewr has joined #zig
cole-h has quit [Ping timeout: 240 seconds]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
FireFox317 has joined #zig
<g-w1> andrewrk: are we moving away from the analyzeInst pattern in zir_sema and just doing the name of the inst?
ltr has joined #zig
Xatenev has joined #zig
ltr has quit [Quit: leaving]
Akuli has joined #zig
albertito has quit [Ping timeout: 240 seconds]
albertito has joined #zig
Xatenev has quit [Ping timeout: 265 seconds]
albertito has quit [Ping timeout: 246 seconds]
albertito has joined #zig
donniewest has joined #zig
ltr has joined #zig
FireFox317 has quit [Remote host closed the connection]
FireFox317 has joined #zig
l1x has joined #zig
uael has quit [Quit: Ping timeout (120 seconds)]
jukan has joined #zig
jukan has quit [Ping timeout: 246 seconds]
marijnfs has quit [Quit: WeeChat 2.8]
leeward has joined #zig
albertito has quit [Ping timeout: 260 seconds]
albertito has joined #zig
waleee-cl has joined #zig
hnOsmium0001 has joined #zig
albertito has quit [Ping timeout: 264 seconds]
albertito has joined #zig
albertito has quit [Ping timeout: 256 seconds]
tnorth_ has quit [Ping timeout: 260 seconds]
albertito has joined #zig
cCCCCcccccCCc has joined #zig
xackus_ has joined #zig
nvmd has joined #zig
leeward has quit [Ping timeout: 256 seconds]
ifreund has quit [Ping timeout: 256 seconds]
ifreund has joined #zig
leon-p has quit [Ping timeout: 256 seconds]
layneson has joined #zig
layneson has quit [Client Quit]
ltr has quit [Quit: leaving]
leon-p has joined #zig
xackus_ has quit [Ping timeout: 264 seconds]
sawzall has joined #zig
LanceThePants has quit [Ping timeout: 272 seconds]
l1x has quit [Quit: Connection closed for inactivity]
frett27_ has joined #zig
jukan has joined #zig
remby has joined #zig
fputs has joined #zig
xackus_ has joined #zig
jukan_ has joined #zig
jukan has quit [Ping timeout: 265 seconds]
wootehfoot has joined #zig
xackus_ has quit [Ping timeout: 240 seconds]
<andrewrk> yes
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
tdeo has joined #zig
tdeo has quit [Remote host closed the connection]
tdeo has joined #zig
remby has quit [Quit: Konversation terminated!]
leeward has joined #zig
<leeward> Huh, all these constants, when preprocessed, are just translated to symbols for the linker script to replace. The addresses aren't even kept.
<leeward> This is going to make automating this library's translation a bit harder.
xackus_ has joined #zig
<FireFox317> leeward, im not sure what you are doing, but maybe using `var` will work
<justin_smith> how hard would it be to to replace std.test.expect with something that bottoms out at the test location? a standard vim build tool integration will jump to the first item in the failure list, and that means it takes me from my failing test to std.testing/expect where it calls @panic
<justin_smith> the straightforward thing of course is to replace `expect(foo)` with `if (foo) {} else @panic("test failure")` but maybe there's something nicer...
<justin_smith> or of course if (!foo) @panic(...) - maybe that's good enough, I guess I rubber ducked it
<justin_smith> actually that's better than test.expect because it lets me specify a failure message to go with the test
midgard_ has joined #zig
midgard has quit [Ping timeout: 256 seconds]
slact has joined #zig
<leeward> FireFox317: I'm porting the SFR definitions for an embedded platform. All these addresses have to be volatile, so until we have volatile blocks or something like them it's just a bunch of pointers.
fritchie has quit [Remote host closed the connection]
fritchie has joined #zig
jukan has joined #zig
fputs has quit [Remote host closed the connection]
wootehfoot has quit [Read error: Connection reset by peer]
jukan_ has quit [Ping timeout: 256 seconds]
frett27_ has quit [Ping timeout: 244 seconds]
nvmd has quit [Quit: Later nerds.]
cole-h has joined #zig
zags has joined #zig
<zags> hey
<zags> defer file.close();
<zags> scratch that
<zags> error: expected type '[]const u8', found '[1024]u8'
<leeward> Slice it.
<zags> what's the zig way of converting that?
<ifreund> you're missing a &
<ifreund> which will give you a *[1024]u8 which coerces to []const u8
<zags> oh I see
<leeward> Or, if you don't want all 1024 bytes, use [0..n] where n is the number of bytes you do want.
<zags> openFileAbsolute wanted a "[]const u8" so it was surprising to need taking the address here
<ifreund> you can also do foo[0..] which gives you the full slice, though its a little more typing than just the &
<fengb> Slices are fat pointers. Arrays are values in zig
<zags> fengb: fat pointers as in pointer+length?
<g-w1> yes
<zags> So *[1024]u8 coercion to []const u8 sets the pointer to the first element and then sets length to 1024
<ifreund> yep
<zags> Thanks. Now, is it possible in openFileAbsolute to handle ONLY the FileNotFound error and then all the other errors separately? Listing all possible errors is brutal.
<zags> In the catch |err| switch (err), that is
<zags> I guess only catch |err|, and then if it?
<g-w1> error.FileNotFound => { dothing}, else => {}
<dutchie> sure, you can do `{ .FileNotFound => { ... }, else => return err, }`
<dutchie> or {} to ignore it
<zags> Ok, thanks
<fengb> You’ll need to capture it if you want to remove it from the returned error set
<fengb> else => |e| return e
<zags> error: incompatible types: 'void' and 'std.fs.file.File'
<zags> const file = fs.openFileAbsolute(out[0..], fs.File.OpenFlags{ .read = true }) catch |err| switch(err) {
<zags> on the catch, hm
<dutchie> your switch is probably a void yeah
<zags> ahhh right, must return in the FileNotFound case as well
<dutchie> return or get a File somehow
<zags> yeah
<zags> next problem, it works if I pass path as a literal string, passing the slice above yields
<zags> if (std.debug.runtime_safety) assert(std.mem.indexOfScalar(u8, file_path, 0) == null);
<zags> :)
<zags> Nevermind, I passed the out buffer from "realpath" instead of the return value. Second time I do this mistake...
<leeward> Is it just me, or is std.c.parse broken? I get an error about std.c.tokenizer not having a member 'Source' that looks internal to std.
nvmd has joined #zig
<leeward> https://godbolt.org/z/dYff9P <- Example
riba has joined #zig
jukan has quit [Ping timeout: 256 seconds]
jukan has joined #zig
riba has quit [Ping timeout: 260 seconds]
jukan has quit [Ping timeout: 256 seconds]
jukan has joined #zig
<leeward> Wow, yeah, this looks very broken. I don't see any bugs against std.c.parse, but it looks totally unusable at the moment.
<leeward> Looks like I have to find vexu.
<ifreund> What does it exist for? wasn't translate-c recently refactored/
<leeward> I don't know. I just want to parse me some C code.
philtor has joined #zig
sebonirc has joined #zig
<andrewrk> that might be dead code
<andrewrk> there is some c parsing happening for macros
xackus_ has quit [Ping timeout: 264 seconds]
zags has quit [Ping timeout: 240 seconds]
sord937 has quit [Quit: sord937]
r0bby has quit [Read error: Connection reset by peer]
tracernz has quit [Ping timeout: 260 seconds]
kushalp has quit [Ping timeout: 260 seconds]
procnto has quit [Ping timeout: 260 seconds]
kwilczynski has quit [Ping timeout: 260 seconds]
rzezeski has quit [Ping timeout: 264 seconds]
kushalp has joined #zig
r0bby has joined #zig
ur5us has joined #zig
<leeward> andrewrk: Do you happen to know where? That's actually all I want.
tracernz has joined #zig
procnto has joined #zig
kwilczynski has joined #zig
rzezeski has joined #zig
<ifreund> leeward: src/translate_c.zig transPreprocessorEntities() I think
<ifreund> which seems to use std.c
<leeward> Ah, yep. There it is.
<leeward> parseCExpr seems a bit relevant too.
jukan_ has joined #zig
jukan has quit [Ping timeout: 256 seconds]
<Ristovski> andrewrk: et al: Is there a reason why this proposed fix has not made it? https://github.com/ziglang/zig/issues/6271#issuecomment-689188734
<Ristovski> or was it just overlooked
<Ristovski> can confirm it fixes using `zig cc` with meson
<andrewrk> there's a way to suggest a diff for master branch
<Ristovski> I know, just wanted to make sure there wasn't a reason before making a PR that would get rejected :P
Akuli has quit [Quit: Leaving]
FireFox317 has quit [Ping timeout: 264 seconds]
FireFox317 has joined #zig
<FireFox317> andrewrk, i found another edge case regarding the type inferrence of blocks in stage2. It is at the bottom of this gist (https://gist.github.com/FireFox317/21a0109030491b3a81fe579b0052fe40). I did manage to implement something that patches up the TZIR after it has been generated in the block. I did this by calling mod.coerce and then adding the instructions that it generated. That felt a bit like a hack, so i was wondering what your
<FireFox317> opinion is about this.
donniewest has quit [Quit: WeeChat 3.0]
<andrewrk> I think this early in the design we should be extremely wary about things that feel like hacks
<andrewrk> taking a look now, thanks for the code snippet
<FireFox317> yep that is what i felt too
nickster has quit [Quit: The Lounge - https://thelounge.chat]
tane has quit [Quit: Leaving]
nickster has joined #zig
<andrewrk> FireFox317, I get `error: TODO implement rlWrap .block_ptr` for your example
<andrewrk> this is probably the case I was thinking of for why we would have thath result location
<FireFox317> andrewrk, yes that is expected. i have a patch
<FireFox317> andrewrk, hmm yeah that might be the case actually. But then still you cannot emit any instructions since you dont know the type of block yet.
<andrewrk> I can tackle this test case now if you want
<andrewrk> it's as good a task as any for stage2
<FireFox317> andrewrk, that would be awesome yes. I'm interested in learning how you would implement that.
jukan_ has quit [Read error: Connection reset by peer]
jukan has joined #zig
<FireFox317> andrewrk, i added a diff to gist (https://gist.github.com/FireFox317/21a0109030491b3a81fe579b0052fe40). This is how i reused the `inferred_ptr` semantics for determining the type of the block (and alloc)
<FireFox317> actually not of the block type (that is done through the break instructions)
gpanders has joined #zig
ur5us has quit [Ping timeout: 260 seconds]
jukan has quit [Read error: Connection reset by peer]
jukan_ has joined #zig