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/
Stephie has quit [Quit: Fuck this shit, I'm out!]
Stephanie has joined #zig
Stephanie has quit [Excess Flood]
Stephie has joined #zig
a_chou has joined #zig
nvmd has joined #zig
cole-h has quit [Quit: Goodbye]
a_chou has quit [Ping timeout: 240 seconds]
a_chou has joined #zig
ur5us_ has quit [Ping timeout: 260 seconds]
tines9 has quit [Ping timeout: 246 seconds]
ncon has quit [Ping timeout: 240 seconds]
ur5us_ has joined #zig
ncon has joined #zig
tines9 has joined #zig
<kandinski> I'm exploring Zig with a view to implement a toy scheme in it, and I'm sure this is not a bug but a misunderstanding of mine: https://termbin.com/iuxb
<fengb> Tuples only coerce to arrays, not slices
<fengb> My array is defined as a slice
<kandinski> [_]FooType would be an array?
<kandinski> where the _ means "compiler, please fill in the length"?
<fengb> Yes but you’d need to define a size for a type
<fengb> The inferred syntax only works for building an array, not defining variables
<kandinski> error: inferred array size invalid here
<kandinski> hmm right
<kandinski> yup, test passing, thanks
<fengb> np
<fengb> There’s a proposal to allow &.{foo} to coerce into a slice. It has some design flaws
<leeward> `.{foo][0..]`?
<kandinski> this is because the compiler is reading the tuple literal as a struct and then coercing it, correct?
<fengb> Right
<kandinski> this worked: var my_array = [_]ErrorUnionOptionalStringType{ mystring, mystring, mystring };
<kandinski> (hope it's ok to paste single lines)
<kandinski> but now of course my_array is of type [3]..., I just didn't have to count them by hand
<leeward> Yep, that should do it.
<kandinski> much appreciated, folks
tines9 has quit [Ping timeout: 256 seconds]
ncon has quit [Ping timeout: 260 seconds]
nephele has quit [Ping timeout: 244 seconds]
nephele_ has joined #zig
nephele_ is now known as nephele
tines9 has joined #zig
ncon has joined #zig
earnestly has quit [Ping timeout: 258 seconds]
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
a_chou has quit [Ping timeout: 256 seconds]
a_chou has joined #zig
a_chou has quit [Remote host closed the connection]
waleee-cl has quit [Quit: Connection closed for inactivity]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
swills has quit [Ping timeout: 260 seconds]
marnix has quit [Ping timeout: 272 seconds]
marnix has joined #zig
swills has joined #zig
rlr has quit [Quit: WeeChat 2.9]
swills has quit [Ping timeout: 264 seconds]
swills has joined #zig
ur5us_ has quit [Ping timeout: 260 seconds]
mattnite has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
mattnite has quit [Quit: Ping timeout (120 seconds)]
cole-h has joined #zig
earnestly has joined #zig
nvmd has quit [Ping timeout: 272 seconds]
_Vi has joined #zig
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
_Vi has quit [Ping timeout: 272 seconds]
cole-h has quit [Quit: Goodbye]
tdeo has joined #zig
<johnLate> Btw. I've solved my problem. Starting with json { "a": { "x": {"1": ["some", "data"] }}}, I can now access the inner array with J.lookup(tree.root, .{"a", "x", "1"}): https://gist.github.com/johnLate/0bde3cf2cc2440889d2bdffa117ec2d6
_Vi has joined #zig
rain1 has left #zig ["WeeChat 1.6"]
ur5us_ has joined #zig
marnix has quit [Ping timeout: 260 seconds]
marnix has joined #zig
ur5us_ has quit [Ping timeout: 260 seconds]
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
_whitelogger has joined #zig
<ikskuh> dang.
waleee-cl has joined #zig
decentpenguin has quit [Ping timeout: 256 seconds]
McKael has joined #zig
decentpenguin has joined #zig
mschwaig has joined #zig
decentpenguin has quit [Ping timeout: 260 seconds]
nvmd has joined #zig
Piraty has joined #zig
decentpenguin has joined #zig
<pixelherodev> ikskuh: lol
<ikskuh> :D
<pixelherodev> ikskuh: `du -sh .weechat/logs` Guess the size?
<ikskuh> "yes"
<pixelherodev> Wrong!
<companion_cube> only 128M here, woo
<pixelherodev> I think when your logs are big enough that they can't fit on a floppy, you've got waaaaay too much info on people.
* pixelherodev wipes logs in a cronjob :P
<leeward> Are they gzipped?
<pixelherodev> Not all of them - for some channels I keep them - but for the more floody channels, there's no point :P
<pixelherodev> leeward: mine aren't :P
<companion_cube> these are my current logs, I have bz2'd backups back to 2012
<leeward> 1.44MiB is not much of anything these days. Can't even fit most executables.
<companion_cube> or any executable if you count the .so it uses :)
<pixelherodev> leeward: if it's plain text - especially plain text - that should be enough
<pixelherodev> companion_cube: who said anything about dynamic linking? ;)
<companion_cube> I mean even the super small C programs often depend on glibc.so
<leeward> libstdc++ is 1.8M on my system.
<companion_cube> my libc.so is 2.1M…
<pixelherodev> I have static binaries under 60 KiB ;)
<leeward> So you're saying they're the rare exception?
<pixelherodev> Funny :P
<Piraty> you can fusemount a zip file ... ;)
<Piraty> (re big weechat logs)
layneson has joined #zig
layneson has quit [Ping timeout: 265 seconds]
Akuli has joined #zig
LanceThePants has quit [Read error: Connection reset by peer]
LanceThePants has joined #zig
WilhelmVonWeiner has quit [Read error: Connection reset by peer]
GrooveStomp has left #zig ["Leaving"]
GrooveStomp_ has left #zig ["Leaving"]
GrooveStomp has joined #zig
zippoh has joined #zig
lunamn has quit [Quit: Ping timeout (120 seconds)]
lunamn has joined #zig
xackus_ has joined #zig
cole-h has joined #zig
neptunepink has quit [Quit: Bye]
nikki93 has quit [Ping timeout: 260 seconds]
neptunepink has joined #zig
WilhelmVonWeiner has joined #zig
nikki93 has joined #zig
a_chou has joined #zig
mattnite has joined #zig
<mattnite> GrooveStomp hey!
<GrooveStomp> Hey mattnite!
a_chou has quit [Remote host closed the connection]
<mattnite> What sort of projects are you writing in zig?
mschwaig has quit [Ping timeout: 244 seconds]
mmohammadi9812 has joined #zig
wootehfoot has joined #zig
moo has joined #zig
wootehfoot has quit [Ping timeout: 256 seconds]
unrahul has joined #zig
jorangreef has joined #zig
zippoh has quit [Remote host closed the connection]
moo has quit [Quit: Leaving]
marnix has quit [Ping timeout: 258 seconds]
wootehfoot has joined #zig
<jorangreef> Hey everyone! What's the fastest echo tcp server for Zig at present on Linux? Could someone whip something up or convert https://raw.githubusercontent.com/MasterQ32/zig-network/master/async.zig to echo? I want to compare Zig's event loop with EPOLL+RECV/SEND, with a new event loop running io_uring (https://github.com/ziglang/zig/pull/6356) on the
<jorangreef> 5.8 kernel, and need a fair candidate so we can get some numbers.
<andrewrk> jorangreef, I'm not aware of anyone doing any benchmarking on this
<andrewrk> I'm excited to see how the io_uring event loop performs though
<ikskuh> oh, do we have that merged already?
<andrewrk> ikskuh, no it's a big PR jorangreef has been working on for a few days
<ikskuh> yeah, i've watching it. got at least 100 mails for it :D
<ikskuh> so having a benchmark would be nice
<justin_smith> I have a WIP of a translation for a simple C client for the jack audio connection kit to zig
<justin_smith> it will be the basis for a blog post intro to zig
<leeward> nifty
<justin_smith> any feedback encouraged - I know this isn't yet ideal zig code https://github.com/noisesmith/zig-jack-examples
<justin_smith> I also copied the original code into the repo, and linked to the original examples
<justin_smith> also, if someone wants to dig even further, the commit history is the refactor that the blog post will walk through (and if that should be fixed I'll rebase so that "history" is a good one for the blog to follow)
marnix has joined #zig
<jorangreef> Thanks andrewrk, I want to hack your tcp chat server at https://gist.github.com/andrewrk/34c21bdc1600b0884a3ab9fa9aa485b8 just to echo back what it reads, for a single connection only, without the hash map overhead, but am running into "evented writes to the same fd is not thread-safe". Could you "pro-tweak" it for me? I have everything else, an
<jorangreef> io_uring-based client and another C contender also using io_uring to compare with. Sorry for those 100 mails ikskuh had a fun weekend.
<justin_smith> it starts with something very close to a decomposed "translate-c" output (where nested conversions on one line are broken into explicit steps per line)
<ikskuh> jorangreef: no worries, i love seeing progress, even if i ignored the thread from the start
* ikskuh aint a major user of async apis :D
<jorangreef> I figured most people would have unwatched around the 30th push D:
<andrewrk> jorangreef, let me see what I can do. It might require a std lib patch hack, but I'm guessing that will be fine for your purposes?
<andrewrk> there's a larger reworking which needs to be done here to avoid trying to put the same fd into epoll multiple times
<ikskuh> jorangreef: i watch the whole repo :D
<jorangreef> andrewrk sure, that would be awesome.
<ikskuh> andrewrk: how's 6250 going? there were some exciting commits in there!
<andrewrk> ikskuh, it's good, you can see progress like this: `git fetch && git log -p origin/stage2-zig-cc -- BRANCH_TODO`
<ikskuh> ah
<andrewrk> above the line break is merge blockers, below is issues I need to file after merging
<andrewrk> so... 33 more commits, then merge, then file 29 github issues :D
<ikskuh> hm. i don't get any output for this :D
<ikskuh> but i've just checked out the right branch :)
waleee-cl has quit [Quit: Connection closed for inactivity]
<andrewrk> this branch changes the CLI btw to remove --c-source; instead it pays attention to file extensions
<andrewrk> zig build-exe foo.zig bar.c
<fengb> So I can't name my zig sources .c? D:
<leeward> Foiled again!
<andrewrk> jorangreef, I wish self-hosted was done so I could be doing event loop stuff with you more right now
<andrewrk> I just feel like this is too much of a bottleneck for me to not focus on it until completion
<ikskuh> andrewrk: the current changes allow for planned simultaneous compilation, right?
<jorangreef> andrewrk, that's the right thing to focus on, will be awesome when self-hosted is done, it's a force multiplier
<andrewrk> ikskuh, yeah you can see it's centered around a job system
<justin_smith> as we discussed previously, data structures are kind of strewn about lib/zig/std, I notice lib/zig/std/atomic/ has atomic concurrent data structures, so if I want to do lock free maybe std/lib/lockfree ? I'm thinking the basics, lock free stack, lock free queue, then a ringbuffer apropriate for usage as a high throughput channel
<andrewrk> I decided not to do evented I/O for now, because that will simplify bootstrapping the compiler
<ikskuh> yeah, true
<ikskuh> neat!
<ikskuh> this is gonna be great!
<ikskuh> finally no long wait times for compiling bearssl anymore :D
<ikskuh> * audit the CLI options for stage2
<ikskuh> also a very good point :)
<andrewrk> ikskuh, I think it is reasonable that we could get parallel builds of c objects by 0.7.0
<ikskuh> nice
<ikskuh> on the change above: how do i pass comiler flags per C file?
<andrewrk> * add CLI support for a way to pass extra flags to c source files
<andrewrk> ;)
<ikskuh> ah :D
<andrewrk> justin_smith, I had originally intended for std.atomic to be lock free data structures, but after weeks working on a lock free queue I failed and gave up and now std.atomic should be renamed to std.threadsafe
<justin_smith> andrewrk: AHA - I'll include that in my work then - better to have std.threadsafe.lockfree or std.lockfree for the non-locking variants?
<andrewrk> I think std lib path names can be decided later
<justin_smith> I know it's tempting to make this an auto-upgrade kind of thing, but certain lockfree algorithms (which are worth using) need slightly different usage apis
<andrewrk> my recommendation would be to work on these lock free data structures externally and treat upstreaming them as a separate project
<justin_smith> cool
<andrewrk> I came to the conclusion that lock free data structures would not actually improve the event loop perf
<andrewrk> but that's just me, maybe you end up finding something different :)
<justin_smith> my hunch was that last one (ringbuffer) would make the real difference
<justin_smith> if your consumers keep up it's a very fast paradigm
<justin_smith> my thought was to have a "channel" abstraction built on ringbuffer + some simplifying assumptions
<companion_cube> if the event loop is plugguable, maybe the standard one can be relatively simple?
<justin_smith> but it's experimental, I'll make some tests and we'll see if I come up with anything
<andrewrk> sounds good
<andrewrk> oh they finally fixed all the regressions I reported in llvm 11rc2. time to run the test suite again
<mattnite> wew!
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
mmohammadi98122 has joined #zig
mmohammadi98122 has quit [Client Quit]
mmohammadi9812 has quit [Ping timeout: 240 seconds]
<andrewrk> jorangreef, I might have taken on more than I can chew today, you might be better finding another way to do your benchmark than waiting for me
<jorangreef> andrewrk, no worries! ...thanks for Zig... incredible work! If anyone else can help, all we need is a simple zig tcp server that accepts a single connection, reads a 1K buffer and immediately writes back.
<ikskuh> multiple clients or single client?
<jorangreef> single client
<ikskuh> let me hack something together quickly
<ikskuh> i need to do a bugfix on zig-network anyways
<jorangreef> thanks ikskuh! here's a C echo server (although it's a little buggy): https://github.com/frevib/epoll-echo-server/blob/master/epoll_echo_server.c
<jorangreef> really appreciate the help ikskuh, my email is joran@coil.com, cheers everyone!
<ikskuh> you're welcome
<ikskuh> server is nearly ready :D
<jorangreef> awesome (y)
<jorangreef> getting late this side, chat tomorrow
jorangreef has quit [Remote host closed the connection]
mmohammadi9812 has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
jjsullivan__ has joined #zig
unrahul has quit [Remote host closed the connection]
<fgenesis> re: ringbuffer: https://ourmachinery.com/post/virtual-memory-tricks/ Ctrl+F gapless
<fgenesis> dunno if something like this is in already
<ikskuh> i haven't even started reading the article, but reading virtual-memory + gapless explains the idea pretty well alredy :D
<fgenesis> and for a job system, i've recently been working on one in plain C, if it helps to draw inspiration from, there: https://github.com/fgenesis/tinypile/blob/wip/tws.h
<companion_cube> fgenesis: is it correct to say that virtual memory makes the "hierarchical table layout" for you?
v_m_v has joined #zig
<fgenesis> companion_cube: huh?
<fgenesis> what are you referring to?
<companion_cube> in the ringbuffer article
<companion_cube> "[…] we could use virtual memory instead, and avoid the complexity of a hierarchical table layout."
<companion_cube> basically that's what virtual memory is, right?
<fgenesis> ...yeah? except that it's the cpu doing it in hardware pretty much
<companion_cube> yeah sure
<companion_cube> basically writing an allocator, there
<fgenesis> but all of this talk about virtual memory becomes a bit nasty when you're on HW without it. stupid 8-bit microcontrollers :D
<fgenesis> so i dunno if anything requiring VM is even suitable for the standard lib
<fgenesis> or even if you're on a 32bit platform and virtual memory is rather scarce by today's standards
<companion_cube> maybe there should be layers of stdlib :)
<companion_cube> small and big
<fgenesis> rust does this since a while iirc
<fgenesis> a core lib that depends on nothing, an os lib that has all the OS things, some more, and finally the stdlib tying them together
<fgenesis> but i am not knowledgeable in rust so please ask someone competent :D
zippoh has joined #zig
<fgenesis> anything is better than in C. syscalls to into the standard lib because uuhhhh, but floating point stuff is totally exotic enough to warrant a libm (at least on *nix)
<fgenesis> like having a libsyscall wasn't a good idea
<ikskuh> fgenesis: nice thing in zig:
<ikskuh> when you don't use it, it's not compiled
<ikskuh> so you can provide such a smart/efficient ringbuffer on OSes with support for it
<ikskuh> and fall back to a less efficient one on other platforms
<fgenesis> yeah, but think about the API
<earnestly> Like io_uring
<ikskuh> it shouldn't differ between both APIs
<fgenesis> as long as that doesn't matter for whether VM is used internally or not, it's good
<ikskuh> *implementations
<fgenesis> yeah i mean that, it totally definitely should not :D
<ikskuh> except that initializing the ringbuffer may fail
mattnite has quit [Remote host closed the connection]
<fgenesis> win10 apparently has an API that doesn't fail, and via NT api directly one can also do this
<fgenesis> see comments in ryg blog
<ikskuh> hmm
<ikskuh> interesting
<fgenesis> re: api, i'm thinking of exposing something like this: https://fgiesen.wordpress.com/2011/11/21/buffer-centric-io/
<fgenesis> and that only works with a pointer spanning twin pages to two separate calls
<fgenesis> so the two steps would be a valid fallback if the more efficient thing isn't available
<fgenesis> because cmon, read() does a memcpy which could be avoided
<ikskuh> :D
<ikskuh> you mean: just do "getReadSlice()" and let the syscall write directly to the buffer? :D
<companion_cube> pretty cool post fgenesis, anyway
<companion_cube> thanks for sharing
<fgenesis> i still want to code an lz secompressor that does this, deliver pointers directly into the decomp window
<fgenesis> *decompressor
<fgenesis> i do consider the buffer-centric-io post a milestone because ti solves all of the problems with 'fread() reported eof but i forgot to check it'-style code
<fgenesis> and fits well into the zig mentality so.. why not
aldessa has joined #zig
<andrewrk> welcome alexnask[m] to the core zig team!
jjsullivan__ has quit [Ping timeout: 260 seconds]
<aldessa> congrats
<BaroqueLarouche> oh yeah! A good pick :)
<ikskuh> whoooo! \o/
<leeward> Woot, congrats
<alexnask[m]> Thanks :)
wootehfoot has joined #zig
<aldessa> So I was reading the Zig documentation and am confused. What does [_] mean? https://ziglang.org/documentation/master/#Multidimensional-Arrays
<alexnask[m]> The underscore in this context means the length of the array will be deduced from the initialization list
<ikskuh> aldessa: [_]T { … } is a array (like [_]i32{2,3}) where the size is inferred by the number of elements
<fgenesis> so no [] like in C
<aldessa> i don't know C
<ikskuh> fgenesis: C arrays are shit from front till back :D
<fgenesis> and here i thought everyone came here because they are fed up with C/C++ :D
<aldessa> i only know OCaml and some Haskell
<fgenesis> i'm sorry
<andrewrk> I love that people are using zig to learn low level programming instead of C :)
<aldessa> i'm trying to avoid learning C++ if i can avoid it haha
<ikskuh> fgenesis: no, zig community is actually wonderfully diverse
<ikskuh> a lot of JS people are here as well
<fgenesis> aldessa: good choice. it was good but then the standards committee started ADDING to it
<fgenesis> and they never stooop
waleee-cl has joined #zig
<fgenesis> ikskuh: and nobody suggested adding a GC yet, for good measure?
<ikskuh> we have a GC in zig :D
<andrewrk> we do?
<ikskuh> :D
<fgenesis> then i'm behind
<alexnask[m]> Someone should do a compiler for a really stripped down version of C++
<aldessa> doesn't LLVM have a GC?
<ikskuh> it's a user space library (obviously)
<ikskuh> the same as we have a borrow checker in zig D
<andrewrk> is that the "conservative" strategy? that's unsound in general but especially in zig when https://github.com/ziglang/zig/issues/3802 is implemented
<alexnask[m]> I think Spex was also doing some GC proof of concept, let me find it
<fgenesis> wait what, a borrow checker that's an external lib and not a langauge feature? how is that even possible
<fgenesis> (and if so, sign me up, scotty)
<alexnask[m]> This is the borrow checker: <https://github.com/DutchGhost/zorrow/>
<ikskuh> we also have traits/interfaces as a library :D
<ikskuh> usp of zig: "we don't need that language feature, we have a library for that"
<alexnask[m]> Its more of a proof of concept, its based on capturing a comptime var and forcing comptime functions to be called with anonymous structs
<alexnask[m]> (to get around the caching)
<andrewrk> oh it's not the conservative stack based thing? interesting
<ikskuh> andrewrk: how strong are you opposed to allow .decls in @Type(.Struct)?
<ikskuh> *strongly
<andrewrk> it's still open for consideration
<ikskuh> oh, nice
<ikskuh> because alexnask[m] and i found a nice argument for it:
<ikskuh> not requiring "*vtable Struct"
<andrewrk> would be open to have a serious discussion about it after I get 6250 off my mind, maybe we can come to a conclusion (accepted or closed) before 0.7.0
<ikskuh> okay, sure :)
<ikskuh> spoiler: interface.zig could be improved further to allow this:
* fgenesis misread read 6502 first and is now sad
<ikskuh> hrhr
<ikskuh> const ptr = IType.init(foobar);
<ikskuh> ptr.method(some);
<ikskuh> instead of
<ikskuh> ptr.call("method", .{some});
<ikskuh> fgenesis: *psst*, i'm waiting for the issue counter to bump up to 6501… :D
<fgenesis> hrhr
<ikskuh> this is gonna be fun
wootehfoot has quit [Read error: Connection reset by peer]
<aldessa> I'm reading the documentation and think some of it is a bit strange?
<aldessa> a lot of it is just code, for example rather than writing 2^29, it says 1 << 29 and some sections are just programs with comments
<ikskuh> aldessa: documentation is very WIP
v_m_v has quit [Remote host closed the connection]
<aldessa> i might make a pull request for the multidimensional arrays, it uses a square matrix so you can't tell the order of the dimensions
zippoh has quit [Remote host closed the connection]
<aldessa> it makes sense to be [m][n] rows x columns like maths but i had to compile to figure out since in maths you write R^m x n instead of m x n R
zippoh has joined #zig
zippoh has quit [Remote host closed the connection]
<aldessa> anyhow good night
<aldessa> cool project
aldessa has quit [Quit: Leaving]
zippoh has joined #zig
xackus_ has quit [Ping timeout: 272 seconds]
zippoh has quit [Remote host closed the connection]
zippoh has joined #zig
eagle2com has joined #zig
marnix has quit [Ping timeout: 264 seconds]
xackus_ has joined #zig
ur5us_ has joined #zig
mmohammadi9812 has quit [Quit: I quit (╯°□°)╯︵ ┻━┻]
zippoh has quit [Remote host closed the connection]
zippoh has joined #zig
zippoh has quit [Remote host closed the connection]
zippoh has joined #zig
marnix has joined #zig
xackus_ has quit [Ping timeout: 260 seconds]
<justin_smith> fgenesis: that usage of a ring buffer (using it for arbitrary sized chunks of data that might wrap around the end) is a special use case I'm not relying on for my channel impl, that's a very clever solution though
<fgenesis> 23:05 < aldessa> it makes sense to be [m][n] rows x columns like maths
<fgenesis> for the record, math notation is wrong! :D
<fgenesis> nobody in their right mind would address something as (y, x)
marnix has quit [Ping timeout: 272 seconds]
Akuli has quit [Quit: Leaving]
lqd has quit [Read error: Connection reset by peer]
procnto has quit [Read error: Connection reset by peer]
jzelinskie has quit [Ping timeout: 272 seconds]
dputtick has quit [Write error: Connection reset by peer]
dputtick has joined #zig
procnto has joined #zig
lqd has joined #zig
jzelinskie has joined #zig
<pixelherodev> alexnask[m]: congrats!
<alexnask[m]> ty :)
radgeRayden has quit [Ping timeout: 272 seconds]
ncon has quit [Ping timeout: 258 seconds]
ncon has joined #zig
radgeRayden has joined #zig
cole-h has quit [Quit: Goodbye]
cole-h has joined #zig
gert has joined #zig
gert is now known as gert_
gert_ has quit [Client Quit]
eagle2com has quit [Ping timeout: 245 seconds]