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/
dimenus has quit [Remote host closed the connection]
ifreund has quit [Ping timeout: 258 seconds]
decentpenguin has joined #zig
ur5us has quit [Ping timeout: 240 seconds]
aerona has joined #zig
<GreaseMonkey> how do optionals tend to behave when you aren't using a pointer? i'm hitting a weird issue somewhere
<GreaseMonkey> i am working on a GZipReader, and it has this field: raw_deflate_reader: ?RawDeflateReaderType
<GreaseMonkey> i can tell if it's null or not, and i can set it to something and initialise it
<fengb> There’s extra space reserved to store the null-ness
<GreaseMonkey> but when i call against it, the results don't seem to propogate back to the field in the GZipReader
<GreaseMonkey> specifically:
<GreaseMonkey> var deflate_reader = try (self.raw_deflate_reader orelse error.Failed);
<GreaseMonkey> var bytes_just_read = try deflate_reader.read(buffer);
<GreaseMonkey> doing a warn("{}", .{self.raw_deflate_reader}) before and after those two lines reveals that nothing is affected
decentpenguin has quit [Quit: decentpenguin]
<GreaseMonkey> ...ok, i managed to get it to work, and then i managed to get rid of the need for an optional type
ur5us has joined #zig
<pixelherodev> Uh
nephele_ has joined #zig
<pixelherodev> oh wait never mind
nephele has quit [Ping timeout: 264 seconds]
nephele_ is now known as nephele
aerona has quit [Remote host closed the connection]
aerona has joined #zig
marijnfs has joined #zig
aerona has quit [Remote host closed the connection]
aerona has joined #zig
marijnfs_ has quit [Ping timeout: 264 seconds]
foobles has joined #zig
xackus_ has joined #zig
xackus has quit [Ping timeout: 260 seconds]
klltkr has quit [Ping timeout: 265 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
klltkr has joined #zig
ur5us has quit [Ping timeout: 240 seconds]
<foobles> is there some way to test if two zigtypes are comparable?
<foobles> like a helper for ir_analyze_bin_op_cmp
<foobles> because I want to basically say "if I ran ir_anaylze_bin_op_cmp, would these two types be valid"
<foobles> well, i suppose I dont need that unless #5155 is accepted
<foobles> nevermind
klltkr has quit [Ping timeout: 240 seconds]
<foobles> and thinking about it, i would be able to extract a lot of the logic from ir_analyze_bin_op_cmp
<foobles> except for the special cases (like null with null, optional with null, tagged union with enum literal, etc.)
<foobles> those would have to also be hard-coded and kept in parallel with ir_analyze_bin_op_cmp, which unfortunately doesn't seem too DRY
<GreaseMonkey> anyway, here's how the implementation's looking so far: https://github.com/iamgreaser/deflate-for-zig/
<GreaseMonkey> usage has changed, it now works as a pipe - feed gzipped data into stdin, get decompressed data into stdout
<daurnimator> pixelherodev: there was no issue with mixins
<foobles> does anyone have an idea for how to do what im talking about without unnecesary redundancy?
<foobles> i guess i could factor out specific conditional expressions into functions
dddddd has quit [Ping timeout: 258 seconds]
aerona has quit [Remote host closed the connection]
aerona has joined #zig
hspak has quit [Ping timeout: 256 seconds]
aerona has quit [Quit: Leaving]
_whitelogger has joined #zig
Invader_Bork has joined #zig
foobles has quit [Ping timeout: 240 seconds]
cole-h has quit [Ping timeout: 264 seconds]
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #zig
frett27 has joined #zig
Winterfury has joined #zig
return0e has quit [Read error: Connection reset by peer]
dermetfan has joined #zig
return0e has joined #zig
<Invader_Bork> what's ZIR?
<mikdusan> zig intermediate representation
<Invader_Bork> mikdusan, ty
Invader_Bork has quit [Quit: Leaving]
Invader_Bork has joined #zig
Winterfury has quit []
<gonz_> So I extended my foray into type introspection and added PureScript & Haskell output for basic zig types
Vexu has joined #zig
ifreund has joined #zig
pingiun has joined #zig
<daurnimator> GreaseMonkey: I'm having another look now
dddddd has joined #zig
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
dermetfan has quit [Ping timeout: 240 seconds]
Vexu has quit [Ping timeout: 240 seconds]
dermetfan has joined #zig
klltkr has joined #zig
Nypsie has joined #zig
ur5us has joined #zig
Nypsie has left #zig ["WeeChat 2.8"]
Nypsie has joined #zig
Xavi92 has joined #zig
<frett27> .... well still in the iotmonitor compilation for orangepi !!!! -> a real nightmare experience :-(
<frett27> zig has been build cross plateform targeting orangepi -> WORKS !!
<frett27> building zig hello world WORKS
<frett27> trying to : zig build-exe -target arm-linux-gnueabihf -mcpu arm1176jzf_s --object /usr/lib/arm-linux-gnueabihf/libleveldb.a -Lpaho.mqt
<frett27> t.c/build/output -Lpaho.mqtt.c/src --object paho.mqtt.c/src/libpaho-mqtt3c.a iotmonitor.zig
<frett27> is missing libc ! ok
<frett27> adding libC ->
<frett27> pi@OrangePi:~/iotmonitor$ zig build-exe -target arm-linux-musleabihf -mcpu arm1176jzf_s --object /usr/lib/arm-linux-gnueabihf/libleveldb.a -Lpahott.c/build/output -Lpaho.mqtt.c/src --object paho.mqtt.c/src/libpaho-mqtt3c.a -lc iotmonitor.zig
<frett27> Semantic Analysis [40/113] Illegal instruction
<frett27> Grrr
<frett27> spend more time to cross compile than adding functionnalities :-(
Winterfury has joined #zig
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
kronnus has joined #zig
ur5us has quit [Ping timeout: 240 seconds]
TheLemonMan has joined #zig
<TheLemonMan> frett27, yo
<frett27> hello
<frett27> tried to recompile the leveldb c++ with zig ....
<frett27> permit then to have to "External dependencies"
<frett27> well, i'm a noobs on this area
<frett27> :-)
<TheLemonMan> try applying #5165, that will show you what's wrong and where it happens
<TheLemonMan> I've fixed some more UB in stage1 so make sure to use a very recent zig version
<frett27> what it should fix ?
<frett27> i recompiled the zig cross plateform yesterday,
<frett27> works fine for arm-linux-musleabihf baseline
<frett27> i learnt the orange pi has an armv6k instruction set,
<TheLemonMan> that PR instructs the embedded C/C++ to emit something more informative than an illegal opcode
<frett27> ok, thank's basically how can i fetch the PR locally ? the git fetch origin pull/5165/head:master failed ?
<TheLemonMan> I usually download the .diff and apply it by hand
Biolunar has joined #zig
FireFox317 has joined #zig
<frett27> i can't find the download diff .. so i added your repo and cherry picked the commit,
<frett27> it is compiling
<TheLemonMan> just take the PR url and add .diff/.patch at the end :P
<frett27> cool !!
<frett27> takes 1s to apply something, and don't pollute the repo
<FireFox317> i should have tested that stuff on my raspberry xd
decentpenguin has joined #zig
kronnus has quit [Quit: WeeChat 2.8]
<frett27> so do i :-),
<frett27> face an issue also, using the build.zig definition target with this definition, does not do the same as command line
<fengb> I should have too. Non trivial stuff blew out my ram so I only really got hello world working >_>
<frett27> in build.zig : exe.setTarget(.{ .cpu_arch= .arm, .os_tag=.linux, .abi=.gnu, .cpu_model = .{ .explicit = &std.Target.arm.cpu.arm1176jzf_s }});
<frett27> is not equivalent to
<frett27> zig build-exe -target arm-linux-musleabihf -mcpu arm1176jzf_s ...
<frett27> fengb, in my case the hello world works fine,
<frett27> fengb, this is when i tried to add some libraries, gnuabi related ..
<frett27> that cause the issue
<TheLemonMan> .abi=.gnu ... arm-linux-musleabihf
<fengb> Yeah that’s what I mean. I didn’t get anything complicated to work so I didn’t stress test the compiler
<TheLemonMan> you got the abi wrong?
<frett27> let me tests, i tried a lot of things
<frett27> TheLemonMan, when defining the mcpu using the build.zig, this is not equivalent to specify the mcpu on the command line
donaldallen has joined #zig
<frett27> when compiling with build.zig and exe.setTarget(.{ .cpu_arch= .arm, .os_tag=.linux, .abi=.gnueabihf, .cpu_model = .{ .explicit = &std.Target.arm.cpu.arm1176jzf_s }});
<frett27> it gives me : pi@OrangePi:~/iotmonitor$ zig build
<frett27> ^
<frett27> LLVM ERROR: Error parsing inline asm
<frett27> yield
<frett27> LLVM Emit Output...<inline asm>:1:2: error: instruction requires: armv6k
<frett27> seems the cpu model is not taken
<frett27> TheLemonMan, when compiling with your patch and this command line : zig build-exe -target arm-linux-musleabihf -mcpu arm1176jzf_s --object /usr/lib/arm-linux-gnueabihf/libleveldb.a -Lpaho.mqtt.c/build/output -Lpaho.mqtt.c/src --object paho.mqtt.c/src/libpaho-mqtt3c.a -lc iotmonitor.zig
<frett27> it respond : Semantic Analysis [40/113] ubsan: type-mismatch @ 0x1a82bfb
<frett27> Illegal instruction
<TheLemonMan> cool, now run `addr2line -e zig 0x1a82bfb` and you'll know what went wrong
<frett27> pi@OrangePi:~/iotmonitor$ addr2line -e `which zig` 0x1a82bfb
<frett27> pi@OrangePi:~/iotmonitor$
<frett27> dlerror.c:?
donaldallen has quit [Remote host closed the connection]
<TheLemonMan> and the mcpu thing is working just fine, it's the stdlib that doesn't know `yield` was introduced with ARMv7
<TheLemonMan> frett27, duh, try running it under gdb
<frett27> :-), yep
Chris660 has joined #zig
<frett27> TheLemonMan, https://pastebin.com/7tRiELK4
<frett27> does the -lc mandatory now ?
<frett27> even if i used the musl, and additional objects needs the c libraries ?
<frett27> mqtt lib needs it
<frett27> and also the leveldb
<TheLemonMan> do you have the code available somewhere?
<TheLemonMan> oh it seems yield is available from v6k on, the hell
<TheLemonMan> oh and it was also written in the message you pasted
<TheLemonMan> fuck I should really learn to read someday
waleee-cl has joined #zig
<TheLemonMan> frett27, should I check out the develop branch or master?
dermetfan has quit [Ping timeout: 265 seconds]
pingiun has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lanodan has quit [Quit: WeeChat 2.7.1]
aerona has joined #zig
halbeno has quit [Ping timeout: 260 seconds]
Chris660 has quit [Ping timeout: 240 seconds]
dermetfan has joined #zig
<ifreund> anyone have a good example of polymorphism in zig lying around?
halbeno has joined #zig
<ikskuh> ifreund: runtime or comptime polymorphism?
<ifreund> ikskuh: runtime
<ikskuh> there's a (closed) PR by alexnask which provides very nice interface stuff
<ifreund> i need to abstract over native wayland and xwayland views
<ikskuh> "std.interface"
<ifreund> i'll take a peek, thanks
<ikskuh> you can also look at std.mem.Allocator
<ikskuh> it's also runtime polymorphism, a bit different though
<ifreund> ah right good point
via has quit [*.net *.split]
so has quit [*.net *.split]
yawniek has quit [*.net *.split]
commander has quit [*.net *.split]
wtw has quit [*.net *.split]
commander has joined #zig
via has joined #zig
wtw has joined #zig
so has joined #zig
yawniek has joined #zig
FireFox317 has quit [Quit: Leaving]
asie has quit [*.net *.split]
Prf_Jakob has quit [*.net *.split]
Prf_Jakob has joined #zig
student069 has quit [Quit: ZNC 1.7.5 - https://znc.in]
<frett27> TheLemonMan, sorry, i was disturbed, back again,
<TheLemonMan> frett27, found the problem, I'll write a patch
<frett27> i'm not aware of all, but want to learn, love zig
<frett27> TheLemonMan, how can i get into zig internal smoothly, i started with external view, the language, i have lot to learn on the compile stuff also.
<frett27> what do you suggest ?
<frett27> is there are things i can do on my time ?
<frett27> TheLemonMan, it will be nice to have a zig iot project, monitoring and "rule them all those iot devices :-)"
<frett27> Tests, docs ?
<pixelherodev> Would patches adding ELF *writing* to std.elf be accepted?
<pixelherodev> Or is that out of scope of stdlib?
<ikskuh> i think andrewrk dumps ZIR into an ELF file right now?
<ikskuh> So maybe his branch already contains that?
<pixelherodev> IIRC it just writes it as ZIR
<pixelherodev> Writing to ELF is in the *plans*
<ikskuh> ah
<ikskuh> so it will probably be required
* ikskuh is interested in better ELF I/O as well :)
<TheLemonMan> frett27, the best way is to get your feet wet by fixing some contributor-friendly bug
livcd has quit [Ping timeout: 250 seconds]
<frett27> TheLemonMan, yes i'm still in this mind set, think the building of small applications can also help lean and focus on important thing for project
AndroidKitKat has left #zig [#zig]
<ifreund> is there a way to set the active field of a union without assigning it?
<ifreund> is my_union.tag1 = undefined; ok?
Xavi92 has quit [Remote host closed the connection]
<ifreund> yeah looks like that crashes, shoot
<ifreund> imo that should be allowed
cole-h has joined #zig
<companion_cube> is tag1 the discriminant tag?
joey152 has quit [Remote host closed the connection]
<ifreund> no, the union itself is undefined
<ifreund> i want to set the active tag and then call my init function like `my_union.tag1.init()`
<ifreund> and yes there's a reason I don't do `my_union.tag1 = MyType.init()`, MyType can't be moved around without breaking pointers due to the design choices of libwayland
<ifreund> I supposed I could have two init functions, but that's super ugly
Vexu has joined #zig
Vexu has quit [Ping timeout: 240 seconds]
Akuli has joined #zig
<xackus_> I think stage1 resolve_llvm_types will need a refactor to properly fix https://github.com/ziglang/zig/issues/4907 and similar issues
<xackus_> the deduplication of pointer ZigTypes differing by is_const, is_volatile, etc is special cased
<xackus_> andrewrk TheLemonMan
dermetfan has quit [Ping timeout: 265 seconds]
dermetfan has joined #zig
<TheLemonMan> yeah that's tricky to solve, the types have the correct (and same) structure but different names
<TheLemonMan> you could special-case the ?[]T case but that feels hacky
<xackus_> i can try rewrite it recursively
joey152 has joined #zig
<xackus_> another solution would be to separate the type and cv modifiers, but would probably require more work
<TheLemonMan> every time I see something that requires too much effort I move it on the stage2 stack heh
<xackus_> but this is needed for zig0 :(
foobles has joined #zig
<TheLemonMan> yeah I meant I put it on hold
<xackus_> it's not that much code, I will probably try the recursive rewrite
Vexu has joined #zig
marijnfs_ has joined #zig
<marijnfs_> im using a c-library that uses void pointers, i use ?*c_void on the zig side for them, is that correct?
<xackus_> actually resolution is already recursive, i will put a new field that points to the canonical ZigType
<marijnfs_> I'm somehow getting issues when using the functions in a spawned thread
aerona has quit [Remote host closed the connection]
<TheLemonMan> xackus_, try changing the LLVM type name only
<TheLemonMan> the inner slice llvm type is correctly generated after dropping the qualifiers
<TheLemonMan> so you need a function to mint a new "base" type w/o any qualifier
<xackus_> yeah, i noticed the inner slice type is correct
marijnfs_ has quit [Ping timeout: 260 seconds]
marijnfs_ has joined #zig
<TheLemonMan> the C ABI is so badly implemented for ARM32 that the compiler is not even able to call zig_clang.cpp methods without corrupting random memory
<TheLemonMan> frett27, you're better off cross-compiling stuff for the time being
<marler8997> found a cool way to initialize my new allocators, instead of makeSliceAllocator(makeAlignAllocator(makeLogAllocator(MmapAllocator { }))), you can do Alloc.mmap.log().align().slice().init
<ifreund> that is a lot cleaner
dermetfan has quit [Ping timeout: 265 seconds]
livcd has joined #zig
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
Vexu has quit [Ping timeout: 260 seconds]
<frett27> TheLemonMan, ok so embedding libs directly, and compile the whole on x64 is the way to go then, big thank's for analysis
Vexu has joined #zig
marijnfs_ has quit [Ping timeout: 260 seconds]
Xavi92 has joined #zig
marijnfs_ has joined #zig
hwerrno has joined #zig
<hwerrno> hello, every one this is the first time i am using irc
<foobles> hello
<foobles> this is the first IRC channel i have ever joined as well
<Xavi92> Welcome hwerrno :)
<hwerrno> zig is very cool
<hwerrno> help
<hwerrno> 😁️
<foobles> help with what?
<foobles> hwerrno
<andrewrk> welcome hwerrno
wootehfoot has joined #zig
<andrewrk> I'm planning to do a zig live coding stream today in a couple hours
<ifreund> \o/ I will be there
<nephele> Hmm, a couple could be 2 or more :)
<andrewrk> I'll pick a concrete time soon, need to take care of some chores first
FireFox317 has joined #zig
<FireFox317> nice andrewrk! self-hosted compiler stuff? :D
<andrewrk> yes
<FireFox317> cool!
decentpenguin has quit [Quit: decentpenguin]
hwerrno has quit [Quit: hwerrno]
drasko has joined #zig
<drasko> Hi all, I am trying to declare var as `const in = self.conn.file.InStream;`
metabulation has joined #zig
<drasko> But I am getting:
<drasko> ./tcp.zig:32:34: error: no member named 'InStream' in struct 'std.fs.file.File'
<drasko> ^
<drasko> const in = self.conn.file.InStream;
* nephele read that as "I am trying to declare war"
<drasko> Although I can see this var over here: https://github.com/ziglang/zig/blob/0.6.0/lib/std/fs/file.zig#L575
<drasko> What am I missing?
<foobles> is `self.conn.file` a type ?
<nephele> If it's complaining about file.File maybe it is self.conn.InStream instead?
<foobles> well InStream exists for the File type
wootehfoot has quit [Ping timeout: 240 seconds]
<foobles> maybe you are only allowed to say `File.InStream`
<foobles> and not (some instance of file).InStream
<drasko> ./tcp.zig:31:29: error: no member named 'InStream' in struct 'std.net.Connection'
<drasko> const in = self.conn.InStream;
<drasko> ^
<drasko> foobles, this is what I am trying:
<drasko> const Client = struct {
<drasko> conn: std.net.StreamServer.Connection,
<drasko> const in = self.conn.file.InStream;
<drasko> fn handle(self: *Client) !void {
<drasko> handle_frame: @Frame(handle),
<drasko> const out = self.conn.file.OutStream;
<drasko>
<drasko> while (true) {
<drasko> const c: u8 = try in.readByte();
<drasko> try out.writeByte(c);
<drasko> }
<drasko> }
<drasko> };
<andrewrk> welcome, drasko
<drasko> Thanks andrewrk
<andrewrk> on IRC you have to use a third party service to paste code and put a link here
<drasko> pastebin?
<andrewrk> sure
<drasko> OK
<ifreund> i recommend https://paste.rs
<foobles> godbolt is good
<foobles> since you can run code there
<drasko> I did not want to paste here whole snippet
<drasko> sorry
<ifreund> godbolt is nice
<drasko> an
<drasko> andrewrk, any ideas why self.conn.file.InStream is not reachable?
wootehfoot has joined #zig
<foobles> I think i know
<foobles> you are trying to access a constant associated with the struct itself
<foobles> but self.conn.file is an INSTANCE of file
<foobles> InStream is a type
<foobles> try doing `self.conn.file.inStream()`
<foobles> yep, that works
<drasko> yep
<drasko> But I did not understand much why :)
<drasko> not a member of File struct?
metabulation has quit [Ping timeout: 260 seconds]
<drasko> And alo I do not understand this one: `pub fn inStream(file: File) io.InStream(File, ReadError, read)` takes one parameter (file)
<drasko> and we gave it none
<foobles> when you use file.inStream(), `file` is the parameter
<foobles> thats how dot-notation works
<foobles> the thing on the left of the dot is passed as the first parameter
<drasko> Ah, OK, thanks
<drasko> this is valuable info
<drasko> And what about this: `pub const InStream = io.InStream(File, ReadError, read);` - isn't `pub const InStream` publicly used member of File struct?
marijnfs_ has quit [Ping timeout: 246 seconds]
<foobles> what do you mean?
<foobles> `pub const InStream` is a constant of the struct itself
<foobles> in your example `self.conn.file` is not the File struct
<foobles> its just an instance of the file struct
<foobles> which means you cant access the struct's constants through it
<drasko> And in instance of the struct I can not use consts of the struct?
<foobles> seems like that is correct
Nypsie has quit [Quit: WeeChat 2.8]
<drasko> I do not quite get it... how is then this field ever used
<drasko> This pub const InStream , I do not see it used in file.zig
<drasko> so it must be used somewhere outside
<drasko> maybe by including this file?
<nephele> Is there a zig mailing list?
<ifreund> yeah
<nephele> Can i send patches and such there?
dermetfan has joined #zig
dirkson has joined #zig
Snetry has quit [Ping timeout: 256 seconds]
Snetry has joined #zig
<dirkson> Hey all. Tinkering around with using zig to build C. Compared to just calling gcc/clang directly, the binaries zig builds for me are very chubby (Double the size) and include links to libraries I don't use (libpthread, libm, etc). What's going on?
<ifreund> nephele: i think that github pull requests are preferred, but that's really a question for andrewrk
<nephele> Yeah i don't have a github account, so was wondering if that was okay too
<dirkson> I suspect it's somehow related to zig's targets system, but I don't understand that at all. The documentation says that the targets don't depend on system files, then immediately shows a zig-compiled binary linking to the system libraries.
<nephele> dirkson, clang ships libcxx zig standardlib and musl sourcecode per default
<andrewrk> nephele, yes you can, but you might have to occasionally send reminder emails if you don't get attention on the patches
<nephele> zig*
<ifreund> dirkson: if you're building a debug build then zig is enabling UBSAN and maybe doing other things
<ifreund> try a release build and see if that's more what you'd expect
<nephele> andrewrk, ah that is fine, I'll prep my first patch to send then (for compiler-rt)
<dirkson> ifreund: That'd explain a lot of the oddities for sure. I assume it builds debug default?
<ifreund> dirkson: yep
<dirkson> ifreund: And as near as I can work out, the only documentation of the C build process is here? ( https://ziglang.org/#Zig-ships-with-libc )
<dirkson> Oh, hey, 0.6 got released? Congrats!
<andrewrk> what do you mean "the C build process" ?
<andrewrk> thanks :)
<ifreund> dirkson: this may be relevant as well https://ziglang.org/documentation/master/#Mixing-Object-Files
<ifreund> but in generaly it's the same as building zig code, you just use addCSourceFile()
<ifreund> s/aly/al/
<dirkson> andrewrk: I have C code, I want zig to compile it for me. I know it can do it, and there are even rumors that build.zig can do it, but I've had a hard time finding info about it
<nephele> "zig cc" can be used like you would use clang
<ifreund> yes build.zig can do it, though docs for the zig build system are somewhat lacking atm
<ifreund> the link i send has an example which is probably what you're looking for
<dirkson> nephele: Hey! That's good info. That produces a very similarly sized binary to gcc.
<nephele> dirkson, there is a nice blog post about that, here: https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html
<ifreund> there's even a zig c++ though i don't think that's made it into the --help yet
<dirkson> ifreund: https://ziglang.org/documentation/master/#Zig-Build-System - Somewhat lacking, yes :D But I'll look into that link
<dirkson> Had to work out how to disable mouse support in my irc client. It had... novel ideas of how the mouse should interact, none of which included being able to click or select links :-/
Xavi92 has quit [Ping timeout: 246 seconds]
<nephele> The best irc clients are ones that ban random people on touch input ;)
<dirkson> Hah, clearly!
<ifreund> yeah... I spent some time reading source code to write my build.zig but the result is quite nice
<ifreund> if you're looking for a slightly more complex example: https://github.com/ifreund/river/blob/master/build.zig
<dirkson> nephele: Yeah, your link is great too. Between the two links I should be able to tinker around for some time.
<nephele> But, can build.zig build me a linux from scratch? ;)
<ifreund> has anyone tried yet? I don't see why not...
<nephele> Well, i did start writing a zig executable to namespace and start compiling stuff, but i didn't use build.zig :P
<dirkson> Idle curiosities: Zig appears to use something clang-related to actually compile. Can that be swapped to gcc? And since zig is aiming at eventual self hosting, does that mean interesting things for the future of zig C compilation? Also, I seem to remember zig grumping at me about my use of tabs in earlier versions, but it didn't mention them when I inserted them in build.zig - Any particular reason?
<nephele> I really really doubt it, the swapping to gcc part, because zig uses libclang to link against and not clang standalone as such
<nephele> zig uses llvm in the backend to compile all its fancy stuff, and libclang uses that too, so one big happy compiler based on llvm :P
<dirkson> That's unsurprising, but unfortunate, as I believe gcc still produces faster code than clang on average. Horrible error messages and debugging though.
<dirkson> nephele: Yeah, I'm not strong on llvm-stuff. Will zig still use the llvm stuff when it's self-hosted?
<nephele> Well, no, it will be written in zig
<nephele> but the zig compiler now using llvm will continue to do so in the future
<nephele> bootstrapping :D
<dirkson> Yeah, that makes sense.
<Snektron> Will llvm be eliminated completely in self hosted?
<FireFox317> andrewrk, any update on the stream time? :)
<andrewrk> I'm waiting for my gf to finish playing D&D and then I'll pick a time :)
Xavi92 has joined #zig
Xavi92 has quit [Remote host closed the connection]
wootehfoot has quit [Ping timeout: 260 seconds]
wootehfoot has joined #zig
<Winterfury> Pardon my noobishness, but does Zig officially require Windows 8 or newer to run? I'm asking because it looks like the binary from zig.windows-i386-0.6.0.zip is not compatible with Windows 7.
<Winterfury> Running it gives me the message about missing entry point in KERNEL32.dll for GetSystemTimePreciseAsFileTime (which is, according to MSDN, a part of Windows 8 API).
<ifreund> Winterfury: yes that's right
<Winterfury> I see.
<andrewrk> note that microsoft has stopped supporting windows 7
xackus_ has quit [Ping timeout: 260 seconds]
<andrewrk> zig has longer support lifecycles for non-proprietary OS's
<marler8997> where does andrew livestream, twitch? and what's is username?
<andrewrk> https://www.twitch.tv/andrewrok estimated start time is +2 hours from now
<demizer> yay!
<companion_cube> a stream tonight? surprise! :D
foobles has quit [Ping timeout: 240 seconds]
foobles has joined #zig
<FireFox317> nice! will stay awake for that :D
<drasko> How to force delay in program? std.time.sleep(3000000); does not seem to stop execution for 3 seconds as I would expect
dermetfan has quit [Ping timeout: 244 seconds]
<drasko> sorry, just saw that these are nanos
Vexu has quit []
Akuli has quit [Quit: Leaving]
<yrashk> I was thinking about consistency of the language. Built-in functions do give an appearance of a function call; but not all of them are in fact function calls, are they?
<andrewrk> ok stream is happening at 19:00 in my time zone, which is in 1hr 6min
<ifreund> 1am, perfect :D
dermetfan has joined #zig
<yrashk> 4pm my time, perfect :)
dermetfan has quit [Ping timeout: 240 seconds]
FireFox317 has quit [Ping timeout: 260 seconds]
<pixelherodev> What's the stream on?
<pixelherodev> Topic, I mean
<waleee-cl> pixelherodev: https://twitter.com/andy_kelley/status/1254167479598882816 , the self-hosted compiler
Invader_Bork has quit [Ping timeout: 240 seconds]
frett27_ has joined #zig
Patrice_ has joined #zig
<pixelherodev> Ah neat
frett27 has quit [Ping timeout: 240 seconds]
frett27_ has quit [Ping timeout: 260 seconds]
<fengb> andrewrk: SSAT?
<drasko> I have problem with following async code: https://paste.rs/l44
<drasko> handlers are actually not executed asynchronously - when client connects to a server and connection is accepted, whole hadler runs and blocks for 5 secs, preventing other clients to connect
<fengb> Sleep isn’t async
<fengb> Async isn’t threading. You need to switch to a non blocking mechanism
<drasko> Is there an example of a non-blocking TCP server
<drasko> fengb, or some other example that demonstrates non-blocking mechanism in Zig
Aransentin has joined #zig
<fengb> Well... the IO handling should be non blocking. Maybe at some point we can switch sleep to be non blocking too
<fengb> e.g. using the outStream or inStream should “just work”
<fengb> It’s still pretty new so there may not be a lot of examples
<Aransentin> I have an array of structs of known length that I'd like to make a bitmask for. Can you make a comptime function that returns an uN for an integer input? e.g. for a list length of 27 I'd get an `u27` back that I can use as a type for my mask.
<Aransentin> I guess I can write a giant switch with one return statement for every length, but that won't look very pretty.
<fengb> It’s possible yes. PackedIntArray might be able to do what you want
<mikdusan> Aransentin: in comptime you can also `const host = @as(std.meta.IntType(unsigned, 27), 0);` and then iterate on AOS, and set each bit on host accordingly.
<Aransentin> Ah, that's exactly what I want
<Aransentin> Thanks! :)
<mikdusan> i'm assuming AOS is comptime known length
<Aransentin> Yep
marijnfs_ has joined #zig
<mikdusan> as fengb pointed out (I've never used it) PackedIntArray looks ideal. maybe PackedIntArray(u1, 27) and then saves you all the bitshift/masking work
marijnfs_ has quit [Quit: Lost terminal]
Patrice_ has quit [Ping timeout: 260 seconds]