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/
<aconbere> hmmmmm
<g-w1> it runs the tests a LOT of times with multiple configurations
forgot-password has joined #zig
<g-w1> the ci will even if your machine doesn't (it requires some flags like -Denable-wasmtime qemu etc). but you can do `zig test file.zig -lc` and it will just run the tests without going through the build system
<aconbere> Okay! so... maybe backing up, my presumption is I'm doing it wrong :-D
<aconbere> Advice on doing it ... right?
<g-w1> saw ur pr, checking it out rn
<aconbere> thanks :)
<g-w1> you don't need a test.zig, just put the test right next to the function
<g-w1> and you need `if (!std.builtin.link_libc) return error.SkipZigTest;` in the test
<g-w1> (a test.zig will work, but i prefer right next to the function)
<aconbere> g-w1: cool, there are no other tests in the file and I wasn't sure what the convention was in this case
<aconbere> yep
<aconbere> easy to change :)
<marijnfs> ugla: indeed, good find!
<marijnfs> i guess stranger things then happen with the generated code? the inline for loop didn't like it it seems, maybe it jumps to previous code somehow
<g-w1> aconbere: oh look, you got feedback already! nice
powerofzero has joined #zig
<aconbere> Magical :)
texno has quit [Ping timeout: 256 seconds]
texno has joined #zig
_whitelogger has joined #zig
marijnfs has quit [Quit: WeeChat 2.8]
rwhid has joined #zig
sundbp has quit [Ping timeout: 256 seconds]
forgot-password has quit [Ping timeout: 256 seconds]
rwhid has quit [Remote host closed the connection]
forgot-password has joined #zig
fputs has joined #zig
zags has quit [Quit: leaving]
ur5us has joined #zig
<daurnimator> aconbere: oh sorry, you should only free if the call succeeded (i.e. I guess move the `freeaddrinfo` below the testing.expectEqual?
<aconbere> daurnimator: makes sense, I was biasing slightly to the defer only because I feel like it's slightly more future proof
<aconbere> if we wanted to add some check to the result value or something, or some crap ends up being added in between it ends up being correct
<aconbere> but I'm happy to do what ya'll think is best :)
<aconbere> hmmmm
<aconbere> Is there any magic that zig might use to check errno or convert status codes into errors? (I don't think so but checking my assumptions)
<aconbere> otherwise it looks like this code in net doesn't check for failure to open the socket file handle?
<aconbere> (This would happen if you exhausted the filehandles but I'm not sure if intuitively I can think of other reasons)
<aconbere> oh, the man page lists them :)
<aconbere> but yeah, I don't /see/ the error handling here but maybe I'm missing it?
powerofzero has quit [Ping timeout: 246 seconds]
<aconbere> oh look! std.os defines socket as returning SocketError
<aconbere> I wasn't looking at the right spot
<aconbere> amazing
<aconbere> it's interesting that there are kind of two classes of these os abstraction functions
<aconbere> the ones that have been wrapped and lifted into std.os that have nice error handling
<aconbere> and then something like getaddrinfo where you check the return status code stuff
powerofzero has joined #zig
<g-w1> exit
<g-w1> sorry :/
<aconbere> :)
gazler_ has joined #zig
gazler has quit [Ping timeout: 260 seconds]
noam has joined #zig
powerofzero has quit [Ping timeout: 246 seconds]
forgot-p1ssword has joined #zig
forgot-password has quit [Ping timeout: 260 seconds]
_whitelogger has joined #zig
earnestly has quit [Ping timeout: 260 seconds]
ur5us has quit [Ping timeout: 264 seconds]
cadelw has joined #zig
_whitelogger has joined #zig
eax has quit [Ping timeout: 268 seconds]
ziguana[m] has joined #zig
<aconbere> huh! My build failed... but in a baffling (to me) way
forgot-p1ssword has quit [Ping timeout: 256 seconds]
forgot-password has joined #zig
<mikdusan> maybe we need to re-think zig cc and c++ drivers; you have time to bounce a few ideas?
<mikdusan> andrewrk: ^
forgot-password has quit [Ping timeout: 246 seconds]
<mikdusan> my thoughts are cc/c++ is very different; goals for best compatibility:
<mikdusan> - fundamental: keep all args in the same position and pass to embedded clang
<mikdusan> - our own arg processors get opportunity to examine the command line
<mikdusan> - opportunity to _replace_ any argument (like the 2nd component of `-o artifact.o` for zig cache purposes
<mikdusan> - but the replacement maintains its position
sord937 has joined #zig
<mikdusan> - we of course can insert the appropriate sysroot/syslibroot stuff if they're not defined
cadelw has quit [Quit: Connection closed]
<mikdusan> - but what I'd like to avoid is (eg) have the linker command line driven solely by our own options structure
<mikdusan> so here's a motivating case:
<mikdusan> `-Wl,-undefined,suppress` or equiv `-Wl,-undefined -Wl,suppress`
cadelw has joined #zig
<mikdusan> and we currently don't handle it. but if we currently did, it needs to be captured by options
<mikdusan> and there are a lot of linker options that we don't capture
<mikdusan> and our position right now is "if we don't support it the option is removed"
<mikdusan> where as I think it would be better to "we ignore unknown options and pass them thru"
<mikdusan> this is only wrt {cc,c++} and not {build-obj,build-exe,build-lib}
<cadelw> Hi everyone! I'm new to Zig and wondering if there's a way to reference packages in tests using `zig test`.
<cadelw> In my `build.zig` I'm adding a package like:
<cadelw> ```
<cadelw>     exe.addPackage(.{
<cadelw>         .name = "mecha",
<cadelw>         .path = "libs/mecha/mecha.zig",
<cadelw>     });
<cadelw> ```
<cadelw> So I can access the package like `usingnamespace @import("mecha");`. But when I run `zig test` I get this error:
<cadelw> ```
<cadelw> error: unable to find 'mecha'
<cadelw> usingnamespace @import("mecha");
<cadelw> ```
<cadelw> Do I need to do something special with the test command to include the package maybe?
mikdusan has quit [Quit: WeeChat 3.0.1]
cadelw has quit [Quit: Connection closed]
waleee-cl has quit [Quit: Connection closed for inactivity]
cadelw has joined #zig
<kevinsjoberg> I have the following code, https://zigbin.io/eaaf64. What I'm trying to achieve is ignoring error.AccessDenied errors and let the while loop continue, but can't figure it out.
tnorth_ has joined #zig
<kevinsjoberg> My code stops and the first AccessDenied error, instead of just skipping it. Not really sure how I should go about it.
<kevinsjoberg> Is it even possible? The docs seem to say that whenever an error is present in the error union, the while loop will exit.
<daurnimator> zigbin.io ?
<kevinsjoberg> daurnimator: Or are you asking what it is?
forgot-password has joined #zig
<kevinsjoberg> It was showcased in the Discord by a fellow Zig member a few days ago. :)
<daurnimator> kevinsjoberg: I mean I didn't know about the site
<kevinsjoberg> daurnimator: I see. It's really neat. :)
<kevinsjoberg> Solved the issue by the way. Had to wrap everything in while(true)
ur5us has joined #zig
<andrewrk> cadelw, you can create a test artifact with build.zig and use addPackage same as with exe, and then run `zig build test`
cadelw has quit [Quit: Connection closed]
lonjil2 is now known as lonjil
cole-h has quit [Ping timeout: 245 seconds]
earnestly has joined #zig
yyp has joined #zig
m4r35n357 has quit [Quit: Ex-Chat]
m4r35n357 has joined #zig
waffle_ethics has quit [Remote host closed the connection]
waffle_ethics has joined #zig
ur5us has quit [Ping timeout: 264 seconds]
Rum has joined #zig
Rum has quit [Client Quit]
thaumavorio has joined #zig
jumpnbrownweasel has quit [Quit: Connection closed]
<tnorth_> Hey there. I'm confused by "error: expected error union type, found ..." in https://zig.godbolt.org/z/9vsvcY (don't look for any logic, just a minimal example). What am I missing?
<ikskuh> if(err_union) |result| {} else |err| {}
<ikskuh> is the syntax for "if with error unions"
<ikskuh> you have an optional though
<ikskuh> if(optional) |set_value| { } else { }
<ikskuh> but you have else |_| {"
<ikskuh> this means that if expects an error union, but gets an optional
wilsonk has joined #zig
<tnorth_> ikskuh: thanks. There is more it seems... https://zig.godbolt.org/z/j1anzW
<dutchie> tnorth_: it's inferring void because it falls off the end of the function without returning. if you add `return null;` at line 29 it should work
<dutchie> also, `if (found) |goal| { return goal; } else { return null; }` is a very long-winded way to write `return found;`
forgot-password has quit [Ping timeout: 245 seconds]
zags has joined #zig
<tnorth_> dutchie: ah thanks, indeed I wasn't returning anything. Regarding the meaning, you're right that makes no sense, I was just trying to build a minimal example
<dutchie> you can even turn it into a one-liner if you want to go all-out: `return bar((self.children orelse return null)[0]);`
<dutchie> ah i see
<tnorth_> dutchie: in the real code the conditions where different but I also had some existing path not returning that I missed. Thanks!
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 256 seconds]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 246 seconds]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 264 seconds]
forgot-password has joined #zig
<yyp> Is there something special you need to add to build.zig in a package except .addStaticLibrary and .addPackage in the parent?
<ifreund> you don't need any build.zig for a package
<g-w1> you don't need addStaticLibrary since a zig package is the source code
<yyp> ok, but having it shouldn't cause any build errors, right?
<g-w1> no
<yyp> error: unable to build stage1 zig object: IsDir
<yyp> I have no idea why it happens and there's no surrounding hints
<ifreund> addPackage() takes a path to the root source, not to a directory
carldd has quit [Ping timeout: 276 seconds]
<yyp> lol
carldd has joined #zig
<yyp> Thanks! Now it works
<yyp> It's not documented anywhere though
<Nypsie> There's some of it on the community made site: https://ziglearn.org/chapter-3/#packages
<ifreund> I mean, all the zig build-exe/lib/obj commands take a path to the root soruce file
<ifreund> a path to a directory wouldn't make any sense
<ifreund> you're right though that the zig build system is largely undocmumented
<yyp> Nypsie: I've read through that but didn't notice that Pkg.path takes a file, not a directory
<yyp> ifreund: I thought that it picks up and recursively runs all build.zig files, which truned out to be not the case
<Nypsie> yyp, fair enough.
<ifreund> nothing done with any build.zig file except the one in your current directory unless you explicitly import it
<yyp> That clears it up, thanks!
<yyp> Before that I was using C quite often and the standard way of building a submodule-library in a makefile was just to cd into it and $(MAKE) it, and thought this was similar in Zig too...
<yyp> Another small thing is that there are not that many Zig packages out there and it's hard to find a standard way of doing something
<ifreund> not that this is all likely to change and become more clear/user friendly when the official package manager is developed
<ifreund> s/not/note/
<yyp> I really wouldn't like a package manager for Zig
<g-w1> why?
<yyp> Right now you need to add a submodule and then manually .addPackage. A PM abstracts the dependencies away and that's what happened to Rust and Node.js - you can have only 1-2 deps and then pull down a gigabyte of stuff
<yyp> That was one of the reasons why I tried Zig
<g-w1> thats an implementation detail. it could download a gigabyte of stuff, or not
<g-w1> i doubt it will as it will try to learn from past package managers
<ifreund> note that the zig package manager probably won't be as easy to do that with as there will be no official centralized repository
<ifreund> also that's more of a cultural problem in the end, zig promotes different ideals than rust
<ifreund> specifically, abstraction isn't seen as the greatest thing since sliced bread
<yyp> Not having centralized repositories wouldn't stop huge dependency graphs if that is all done behind the developer's back
yyp has quit [Quit: disconnected]
<qbit> is zig-bootstrap hanging for anyone else on aarch64 darwin?
yyp has joined #zig
forgot-password has quit [Read error: Connection reset by peer]
bitmapper has joined #zig
forgot-password has joined #zig
<tnorth_> What is the proper way to implement some kind of generator in Zig? Can/should this be implemented with custom iterators?
sundbp has joined #zig
<ifreund> tnorth_: probably a struct that stores some state with a next() function returning an optional
<ifreund> which is incidentally how "iterators" are usually implemented
<tnorth_> ifreund: ok, there is no particular feature for that (ie equivalent to python yield) available/planned in Zig?
<ifreund> well you can also implement this using async, though it wont play well if you're using an async event loop
<tnorth_> ifreund: I'm fine writing iterators, just wanted to know :)
<ifreund> I think a simple iterator will be good enough for almost all use-cases
<tnorth_> interesting link, thanks. I'll go for the iterators then
yyp has quit [Quit: disconnected]
texno has quit [Quit: leaving]
MrMobius has joined #zig
LewisGaul has joined #zig
<MrMobius> can zig update a a binary without recompiling the whole thing? I remember reading something about that but dont know what its called to google it
<ifreund> MrMobius: the WIP self-hosted compiler can do this, stage 1 cannot
<MrMobius> ifreund, thats it. ty
<LewisGaul> ifreund just saw your push to the zig fmt PR - I was actually just starting to look into unifying the logic myself. I'll take a look at your changes and provide a review if that's helpful?
<LewisGaul> oh you already merged
<ifreund> Indeed, though don't let that stop you from giving the new code a read and sending a PR if you find anything amiss :)
<LewisGaul> I actually found another potential improvement, although you seem to have fixed it with your changes, good job! Previously the continue was reformatted onto a newline:
<LewisGaul> while (i < 10) : ({
<LewisGaul>  i += 1;
<LewisGaul>  j += 1;
<LewisGaul> }) continue;
<LewisGaul> I feel like I wasn't massively helpful in the end on that issue, but I'll just have a go with something a bit different sometime :)
<ifreund> Don't feel discouraged that you didn't rewrite the whole function like I did, I've had a lot of experience working on zig fmt in the past month or two
<ifreund> that code definitely isn't trivial
<ifreund> if you want to PR a test case for that improvement that would be most welcome, then it won't regress :)
<ifreund> and the only way to get familiar with the code is to keep banging your head against it, which is pretty much what I did while sending patches at andrew for https://github.com/ziglang/zig/pull/7920
<LewisGaul> Sure I can create a PR to add that (sounds like something I can do with minimal head banging ;) )
<LewisGaul> But yes you're right, it's all about gradually getting familiarity (and getting to know people like yourself in the community who all seem to be very friendly)
<LewisGaul> Not sure if you saw my blog post about this zig contribution? https://www.lewisgaul.co.uk/blog/coding/2021/03/02/first-zig-contribution/
<LewisGaul> and the list of posts I put together at https://gist.github.com/LewisGaul/d5b303da9c03bf95f778c64e12ef1c5e
<ifreund> no I didn't yet!
<ifreund> the parser tests are in lib/std/zig just like other standard libary unit tests
<LewisGaul> yep, found them eventually last time!
<ifreund> the root test directory is for compiler tests
<LewisGaul> got it
<ifreund> if you want another issue to tackle, I think https://github.com/ziglang/zig/issues/7855 just needs a test case before we can close it
<LewisGaul> will take a look, and here's the PR for the testcase you requested: https://github.com/ziglang/zig/pull/8253
<ifreund> nice, I'm just going to be lazy and let the CI do it's job before pressing the merge button :)
LewisGaul has quit [Quit: Connection closed]
yyp has joined #zig
forgot-password has quit [Ping timeout: 264 seconds]
forgot-password has joined #zig
dyeplexer has joined #zig
cepheus has joined #zig
forgot-password has quit [Ping timeout: 246 seconds]
MrMobius has left #zig [#zig]
cole-h has joined #zig
<cepheus> only just found out that serialization is gone from zig master which is a little disappointing though understandable
<cepheus> especially since it got dumped into std-lib-orphanage in a non-working state
leon-p has quit [Quit: leaving]
sundbp has quit [Ping timeout: 260 seconds]
zags has quit [Quit: leaving]
<ikskuh> cepheus: feel free to make a working, maintained package out of it :)
<cepheus> it's something i'd consider if i was a more active user of zig, but also conversely such changes make me apprehensive to build things with zig if i am going to use standard library constructs that are discontinued and require manual fixup. but regardless i know things are not set in stone and i can't rely on them to be
<cepheus> i'm not kicking up a fuss or anything, just posting my thoughts
<ifreund> sounds like you might want to wait until 1.0
<ifreund> the language isn't stable yet, let alone the standard library
<ifreund> everything is trending towards stability though, and cutting things from the std which don't belong is part of that process
<cepheus> i can be slightly annoyed and deal with it, i am not exactly writing anything mission critical, just hobbyist things
<cepheus> the side effect being that since side projects are something i drift in and out of, i have catching up to do every so often
dreda has quit [Ping timeout: 264 seconds]
dreda has joined #zig
halbeno_ has joined #zig
tnorth_ has quit [Ping timeout: 258 seconds]
cepheus has quit [Ping timeout: 265 seconds]
halbeno has quit [Ping timeout: 265 seconds]
midgard has quit [Ping timeout: 246 seconds]
cepheus has joined #zig
midgard has joined #zig
xentec has quit [Quit: memento mori]
xentec has joined #zig
shodan45 has joined #zig
haliucinas has quit [Remote host closed the connection]
haliucinas has joined #zig
mikdusan has joined #zig
Akuli has joined #zig
haliucinas has quit [*.net *.split]
bitonic has quit [*.net *.split]
Sumera[m] has quit [*.net *.split]
siraben has quit [*.net *.split]
leibniz[m] has quit [*.net *.split]
ugla has quit [*.net *.split]
haliucinas has joined #zig
LewisGaul has joined #zig
ugla has joined #zig
siraben has joined #zig
bitonic has joined #zig
Sumera[m] has joined #zig
siraben has quit [Max SendQ exceeded]
marijnfs has joined #zig
notzmv has quit [Ping timeout: 246 seconds]
aconbere has quit [Ping timeout: 245 seconds]
aconbere has joined #zig
pafmaf[m] has quit [Ping timeout: 240 seconds]
Snektron has quit [Ping timeout: 240 seconds]
superdump has quit [Ping timeout: 244 seconds]
ziguana[m] has quit [Ping timeout: 244 seconds]
posixlix has quit [Ping timeout: 244 seconds]
ifreund_ has quit [Ping timeout: 241 seconds]
protheory8-new-m has quit [Ping timeout: 249 seconds]
kameliya[m] has quit [Ping timeout: 249 seconds]
kshlm has quit [Ping timeout: 249 seconds]
fengb has quit [Ping timeout: 247 seconds]
suhashebbar[m] has quit [Ping timeout: 247 seconds]
jaens[m] has quit [Ping timeout: 247 seconds]
bitonic has quit [Ping timeout: 265 seconds]
watzon has quit [Ping timeout: 268 seconds]
tjammer[m] has quit [Ping timeout: 268 seconds]
Nypsie[m] has quit [Ping timeout: 268 seconds]
cepheus has quit [Ping timeout: 264 seconds]
ugla has quit [Ping timeout: 265 seconds]
Sumera[m] has quit [Ping timeout: 265 seconds]
dyeplexer has quit [Remote host closed the connection]
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
pafmaf[m] has joined #zig
kameliya[m] has joined #zig
Sumera[m] has joined #zig
jaens[m] has joined #zig
bitonic has joined #zig
ziguana[m] has joined #zig
leibniz[m] has joined #zig
tjammer[m] has joined #zig
suhashebbar[m] has joined #zig
ifreund_ has joined #zig
siraben has joined #zig
cepheus has joined #zig
ugla has joined #zig
kshlm has joined #zig
Nypsie[m] has joined #zig
posixlix has joined #zig
watzon has joined #zig
fengb has joined #zig
Snektron has joined #zig
protheory8-new-m has joined #zig
superdump has joined #zig
fputs has quit [Quit: WeeChat 3.1]
wootehfoot has joined #zig
<LewisGaul> I'm having problems with the output from failing tests in `parser_test.zig` - seems possibly related to non-ascii characters not being supported in my (WSL) terminal? It's showing me the expected output but not the actual output and diff as it should, see https://pastebin.com/FDGpAd3Z . Any ideas?
<ifreund> yeah, I'm pretty sure it's due to the non-ascii character it's using for EOF
<ifreund> not very helpful I know, but it works fine for me on linux
<ifreund> This character: ␃
<ifreund> except that's ascii...
<aconbere> `
<aconbere> is that something someone can boop for me (I don't seem to have bits to rerun)
<ifreund> I think you can close and re open to make it rerun?
<ifreund> looks like a supurious failure though
<aconbere> agreed
<aconbere> close and reopen did boop the built job
<aconbere> so fingers crossed
<LewisGaul> ifreund I tried removing that character and I think that fixed the problem for me before, but this time it doesn't seem to be helping (I'm wondering if I need to do something to trigger zig to rebuild that change, although even rerunning `make install` hasn't helped)
<ifreund> LewisGaul: what zig binary are you using to run `zig test /path/to/parser_test.zig`?
<ifreund> e.g. I do ./build/zig test lib/std/zig/parser_test.zig
<LewisGaul> The one created by `make install` - I'm in the `build/` dir running `./zig test ../lib/std/zig/parser_test.zig` as you can see in the pastebin
sawzall has quit [Read error: Connection reset by peer]
sawzall has joined #zig
sawzall has quit [Read error: Connection reset by peer]
sawzall has joined #zig
<ifreund> zig test should rebuild that change just fine
<ifreund> you've deleted the character in std.testing.printWithVisibleNewlines()?
stilbruch1 has joined #zig
drakonis- has joined #zig
jah has quit [Ping timeout: 256 seconds]
drakonis has quit [Ping timeout: 256 seconds]
stilbruch has quit [Ping timeout: 256 seconds]
Piraty has quit [Ping timeout: 256 seconds]
Piraty has joined #zig
grive has quit [Read error: Connection reset by peer]
][_R_][ has quit [Ping timeout: 256 seconds]
drakonis- is now known as drakonis
[RMS] has joined #zig
<marijnfs> what is an up to date 'write/log to file in zig' example?
<marijnfs> this is hard to look for I can tell you
<Nypsie> https://ziglearn.org/chapter-2/#filesystem to write to file. If you want to log to files, you could overwrite std' log function by definiting it in the root of your project
<Nypsie> This just made me realize how ugly that main file actually is D:
m4r35n357 has quit [Ping timeout: 264 seconds]
st4ll11 has quit [Ping timeout: 264 seconds]
st4ll11 has joined #zig
jah has joined #zig
<andrewrk> mikdusan, sounds like a nice topic for the next stage2 meeting :)
<LewisGaul> ifreund sorry for the noise, just realised ZLS opened a different version of the file (the copy for my 0.7.1 zig binary)
m4r35n357 has joined #zig
zags has joined #zig
<LewisGaul> however, `./zig test` still doesn't seem to be rebuild the change (`make install` does)
<cepheus> as an aside, with some minor tweaks i have actually gotten the serialization code working under current zig master (at least as far as the test suite goes), but i can't really commit to keeping it maintained, so i've just pushed it out in a fork of the orphanage
<ifreund> LewisGaul: zig test should run the tests in that file with your modified version of the std
<ifreund> it won't rebuild thi zig executable with your changes
<ifreund> but you don't need to do that if all you want to do is run the tests
<LewisGaul> yeah it just doesn't seem to be picking up the change I made in std.testing
<andrewrk> pair programming stream with loris in 10 min: https://www.twitch.tv/andrewrok/ we're going to be exploring converting redis to zig and seeing how it goes
<txdv> live right now?
<Nypsie> In 10 mins :)
<txdv> https://youtu.be/pacsngNYXI0?t=3131 what is this song at the end?
<marijnfs> Nypsie: thanks, exactly what I needed
<marijnfs> hell yeah pair programming
<Nypsie> marijnfs: You're welcome
<marijnfs> omg twitch is so hard to navigate
zags has quit [Ping timeout: 256 seconds]
leon-p has joined #zig
waleee-cl has joined #zig
marijnfs has quit [Read error: Connection reset by peer]
zags has joined #zig
<txdv> andrew you need to give me the name of the song in that last youtube link
<txdv> is there a special channel for stream?
<Nypsie> Loris manages the Showtime channel, I'll ask him on Discord for its name
notzmv has joined #zig
sord937 has quit [Quit: sord937]
<aconbere> huh... here's an interesting one
<aconbere> when I call getaddrinfo to fill in my address struct, it returns values in the wrong type to pass to socket
<aconbere> socket is ... nicely wrapped up at a higher level than the direct libc access
cole-h has quit [Ping timeout: 256 seconds]
<aconbere> so I assume it's signature is more fitting to accepting stuff like zig enums
<aconbere> `./src/main.zig:33:40: error: expected type 'c_uint', found 'i32'`
cole-h has joined #zig
<aconbere> maybe I can do a quick cast into the enum
<aconbere> huh
<aconbere> okay so... that's weird
<aconbere> linux.socket expects "domain" to be u32
<aconbere> use of those in libc is expected to flow from addrinfo.family into socket
<aconbere> but the types don't line up
<aconbere> I wonder if its that way in libc
<aconbere> libc man page says family should be an int on addrinfo not i32
<aconbere> but not sure what's actually encoded in source
travv0 has quit [Ping timeout: 256 seconds]
travv0 has joined #zig
neptunepink has quit [Ping timeout: 265 seconds]
<aconbere> my libc says `extern int socket (int __domain, int __type, int __protocol) __THROW;`
<aconbere> u32 just seems like it's the wrong type for linux.socket to expose?
<aconbere> (I might have that backwards lol)
wootehfoot has quit [Read error: Connection reset by peer]
Piraty has quit [Ping timeout: 256 seconds]
neptunepink has joined #zig
cCCCCcccccCCc has quit [Ping timeout: 256 seconds]
<ifreund> aconbere: linux.socket() is a direct syscall not going through libc, it only has to adhere to the kernels interface not the design decisions of libc
<ifreund> std.c.socket should have the signature you see in your man page
<aconbere> `pub extern "c" fn socket(domain: c_uint, sock_type: c_uint, protocol: c_uint) c_int;`
<aconbere> yeah that looks to be correct
<aconbere> interesting
<aconbere> and presumably this all works nicely in C because c doesn't give two craps about casting hahaha
ur5us has joined #zig
yyp has quit [Quit: disconnected]
V has quit [*.net *.split]
dddddd has quit [*.net *.split]
Ristovski has quit [*.net *.split]
blueberrypie has quit [*.net *.split]
nore has quit [*.net *.split]
di-wu has quit [*.net *.split]
ikskuh has quit [*.net *.split]
blueberrypie has joined #zig
di-wu has joined #zig
dddddd has joined #zig
Ristovski has joined #zig
nore has joined #zig
ikskuh has joined #zig
V has joined #zig
<aconbere> ^ paste of what my netdb.h defines addrinfo as
<aconbere> unless int <-> i32?
<tdeo> these snippets seem to be exactly the same
<aconbere> tdeo: does i32 map to int?
<aconbere> c's int that is
<tdeo> i think the gist was meant to be c, but it's the zig code
<aconbere> doh!
<ifreund> i32 might be the same as C's int depending on the target
<tdeo> as far as i know, on linux, c_int is always the same as i32
<ifreund> to match C's int in zig use c_int
<aconbere> (I fixed my gist)
<aconbere> well crap
ifreund has quit [Ping timeout: 260 seconds]
ifreund has joined #zig
Ristovski has quit [Quit: 0]
[Ristovski] has joined #zig
[Ristovski] is now known as Ristovski
<LewisGaul> Is there a reasonable way to go from `Node.Index` to `TokenIndex` so that I can use `tree.tokensOnSameLine()` ? Specifically I want to check whether `SwitchCase.Ast.target_expr` is on the same line as the token that comes just before it (either arrow token or payload)
<ifreund> LewisGaul: you probably want either tree.firstToken() or tree.lastToken()
<ifreund> an ast node is usually more than one token
<LewisGaul> yeah, I guess the problem is I don't know what type of node the `target_expr` is, can I rely on `tree.firstToken()` giving the first token in the source?
sundbp has joined #zig
<ifreund> tree.firstToken() takes a Node.Index and gives you the first token of that ast node
<LewisGaul> yeah, ok probably does what I need
leon-p has quit [Quit: leaving]
blueberrypie has quit [Read error: Connection reset by peer]
blueberrypie has joined #zig
<aconbere> ha
<aconbere> `reached unreachable code
<aconbere> woo hoo!
<aconbere> success
nore has quit [Ping timeout: 256 seconds]
nore has joined #zig
marijnfs has joined #zig
<marijnfs> amazing, redis cross compile to m1
<ifreund> yeah, pretty crazy stuff
g-w1 has quit [Ping timeout: 260 seconds]
<aconbere> well it took me a while
<aconbere> but I have a working tcp echo
<aconbere> haha
<aconbere> thanks for the help ya'll
<ifreund> nice :)
<aconbere> so much to show for it haha
g-w1 has joined #zig
osa1 has quit [Remote host closed the connection]
osa1 has joined #zig
<LewisGaul> ifreund another question on this zig fmt fix... `Node.Tag.string_literal` appears to be used for `"foo"` and `\\foo` string literals, but I think we only want the latter to be on a new line - any suggestions how to do this?
<ifreund> LewisGaul: multiline string literals have their own tag: multiline_string_literal
<LewisGaul> oh I did see that, sorry just my debugging skills letting me down and confusing me
<ifreund> no worries!
leon-p has joined #zig
<LewisGaul> I'm pretty convinced that just running `./zig test` isn't enough to pick up the std changes I'm making - I'm currently having to run `make install` each time which is kind of slow. Maybe this is just a problem with WSL and therefore not really worth looking into?
<ifreund> it could be that WSL breaks the caching sytem somehow
<ifreund> I don't know what effect it has on the linux filesystem
notzmv has quit [Ping timeout: 245 seconds]
<LewisGaul> maybe I should try Windows (I'd rather not though!) or WSL2 at some point
grive has joined #zig
<ifreund> or just install linux alongside windows if you have space on the drive
<ifreund> or wipe it and have only linux :P
<LewisGaul> work laptop, slightly limited in what I can do :p  possibly should set up a VM
<ifreund> LewisGaul: from a very superficial duckduckgo, WSL2 might fix your issues
<LewisGaul> thanks, I've tried to migrate before and it gave me other issues, but will give it another go at some point and see if that helps
<ifreund> specifically, WSL 1 doesn't seemt to use a real linux kernel or file system while WSL2 has ext4
notzmv has joined #zig
Akuli has quit [Quit: Leaving]
notzmv has quit [Ping timeout: 246 seconds]
_whitelogger has joined #zig
_whitelogger has joined #zig
marijnfs2 has quit [Ping timeout: 272 seconds]
marijnfs2 has joined #zig
ur5us has quit [Ping timeout: 264 seconds]
LewisGaul has quit [Ping timeout: 240 seconds]
ur5us has joined #zig