ChanServ changed the topic of #zig to: zig programming language | | be excellent to each other | channel logs:
kenaryn has quit [Quit: WeeChat 2.3]
wootehfoot has quit [Read error: Connection reset by peer]
<daurnimator> The windows failure in CI for seems unrelated to the PR
<andrewrk> I believe it
lunamn has quit [Quit: leaving]
<daurnimator> andrewrk: hmmm? "The following command exited with error code 3221225477: D:\a\1\s\build\dist\bin\zig.exe test D:\a\1\s\test\stage1\behavior.zig --library c --test-name-prefix behavior-aarch64-linux-musl-Debug-c-multi --cache-dir D:\a\1\s\zig-cache --name test -target aarch64v8_5a-linux-musl --override-lib-dir D:\a\1\s\lib"
<andrewrk> that's not a particularly helpful error message is it
<andrewrk> appears to be EXCEPTION_ACCESS_VIOLATION. not sure what that means
<andrewrk> oh, that's a segfault
<andrewrk> hmm I thought we had segfault handlers set up for windows
return0e has quit [Ping timeout: 240 seconds]
return0e has joined #zig
Jezza__ has joined #zig
Ichorio_ has quit [Ping timeout: 246 seconds]
doublex_ has joined #zig
doublex has quit [Ping timeout: 250 seconds]
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
muffindrake1 has joined #zig
muffindrake has quit [Ping timeout: 276 seconds]
mahmudov has quit [Remote host closed the connection]
return0e has quit [Ping timeout: 276 seconds]
return0e has joined #zig
chemist69 has quit [Ping timeout: 250 seconds]
chemist69 has joined #zig
doublex_ has quit [Ping timeout: 268 seconds]
<daurnimator> andrewrk: still around?
doublex has joined #zig
rjtobin has quit [Ping timeout: 240 seconds]
ltriant_ has quit [Ping timeout: 265 seconds]
achaninja has joined #zig
achaninja has quit [Remote host closed the connection]
mahmudov has joined #zig
_whitelogger has joined #zig
achaninja has joined #zig
jjido has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Snektron> What's the difference between @as and @cast?
return0e_ has joined #zig
return0e has quit [Ping timeout: 240 seconds]
return0e has joined #zig
return0e_ has quit [Ping timeout: 265 seconds]
return0e_ has joined #zig
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
forgot-password has joined #zig
<mq32> hello people :)
<mq32> pixelherodev: my "kernel" has some nice progress:
<daurnimator> mq32: nice
<mq32> writing a good text editor is pain
return0__ has joined #zig
return0e_ has quit [Ping timeout: 240 seconds]
<daurnimator> indeed
<mq32> btw, that editor is what i needed the allocator for :D
<daurnimator> hell even a good terminal UI library is super hard
<mq32> oh yeah
<mq32> and i *think* i found a bug in std.mem.copy?
<mq32> @setRuntimeSafety(false); assert(dest.len >= source.len);
<mq32> that assert should never trigger as the compiler doesn't check for unreachable
<mq32> or am i wrong?
<daurnimator> sounds about right :P
<daurnimator> I know scientes has a PR open at the moment for mem.copy
<mq32> if i have some motivation, iÄ'
<mq32> I'll do some stdlib documentation the next days
<mq32> there's still a lot missing or could be better
return0e_ has joined #zig
forgot-password has quit [Ping timeout: 240 seconds]
return0__ has quit [Ping timeout: 252 seconds]
<Sahnvour> playing with async, am I doing something wrong here ? The output of @frameSize is unexpected
<mq32> Sahnvour: this is 0x9090909090909090
<mq32> i think this is rather unexcpected
<daurnimator> Sahnvour: what arch? I get: 8658703, 48 74900186333184, 32
<mq32> 8658703 same here, x86_64-linux
<Sahnvour> windows
<Sahnvour> x64
<Sahnvour> both values on each line should be equal, as the doc states, right ?
<daurnimator> Sahnvour: oh. you found a bug
<daurnimator> Sahnvour: @frameSize() doesn't take arguments
<daurnimator> it returns the size of the *current* frame
<Sahnvour> actually it does, even if the doc says otherwise
<daurnimator> its an error that it doesn't throw an error for invalid number of arguments
<Sahnvour> doesn't compile without argument
<Sahnvour> that's what I suspected first :) seems there's a bug somewhere
<daurnimator> hrm yeah; the tests in std lib pass a value
<daurnimator> either way sounds like a bug to file
<Sahnvour> doing it
_whitelogger has joined #zig
forgot-password has joined #zig
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #zig
* daurnimator is thinking about 764 in relation to his "Mixin" thing from yesterday
<daurnimator> wow std/debug.zig really needs tidying up.
<daurnimator> I already did some in as part of a completely different effort
<daurnimator> I'm hesitant to go too far without having that re-reviewed first
return0__ has joined #zig
<daurnimator> hell right now I can't figure out how openSelfDebugInfoPosix even works
<daurnimator> oh..... is `S` essentially a "static" variable? oh god
return0e has quit [Ping timeout: 268 seconds]
dimenus has quit [Ping timeout: 246 seconds]
return0e_ has quit [Ping timeout: 268 seconds]
return0e has joined #zig
<daurnimator> so other than a bit of a hatchet job in std/debug.zig; this is going quite well
<daurnimator> heaps of little usability improvements all around the place
<daurnimator> really speaks well of zig that this has been possible the whole time; it just had to be discovered
<daurnimator> andrewrk: This commit contains the standard library changes to move InStream to what I'm calling the "Mixin" style.
<daurnimator> std lib tests pass on my machine :)
<daurnimator> stupidly I did it on top of my open PR #3644; so I won't send a draft PR for this new code until that is merged or closed
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
frmdstryr has joined #zig
waleee-cl has joined #zig
<via> daurnimator: i haven't been keeping up, but how does your change affect using streams with async read functions?
return0e_ has joined #zig
return0e has quit [Ping timeout: 252 seconds]
casaca has quit [Ping timeout: 246 seconds]
casaca has joined #zig
Akuli has joined #zig
mahmudov has quit [Remote host closed the connection]
casaca has quit [Ping timeout: 240 seconds]
casaca has joined #zig
<fengb> daurnimator: could this replace runtime interface pointers too?
casaca has quit [Ping timeout: 240 seconds]
casaca has joined #zig
<andrewrk> mq32, wow, cool demo!
<fengb> andrewrk: so all initialization will use anonymous syntax?
<andrewrk> yes
<andrewrk> `Foo{.a = b}` becomes redundant syntax
<mq32> andrewrk, thanks :) will get even cooler!
wink_ has joined #zig
dimenus has joined #zig
porky11 has joined #zig
<mq32> daurnimator: nice thing with mixin!
<mq32> fengb: probably not as mixins don't have a common pointer type
<andrewrk> daurnimator, nice, I'll check this out soon
<andrewrk> this could be an important step in making the std lib integrate better with evented I/O for writes
<mq32> coolest thing about the mixin style is that you don't have the error problem anymore :)
<andrewrk> it removes a runtime-known function pointer call, which is a big deal in zig
<andrewrk> it's not obvious yet but it also avoids issues with stack overflow
<mq32> yeah, but if i'm right you loose the ability to make *actual* pointers to an InputStream object
<andrewrk> I believe that works fine, but you will have to use `input_stream: var` to accept the pointer as a parameter
<mq32> yeah
<mq32> but: my "size bloat" sense tingles
<mq32> as with this, any function call with a differnet stream type gets instantiated seprarately
<andrewrk> I agree, that is something to consider
<mq32> it's a big problem in C++ with templates
<fengb> With mixins: I've had issues in the past tracking down where they come from. Could we have something like namespaced methods?
<mq32> at work i have a badly optimizing compiler (means: no LTO or comdat folding)
<mq32> the executables for *simple* programs are 8 to 16 megs large
<andrewrk> I've had the same problem as fengb before
<mq32> i still think #2938 is a nice approach on this whole object oriented/interfacy thing
<mq32> how well does something like this optimize?
<dimenus> is this suppsoed to be valid zig?
<andrewrk> dimenus, yes
<andrewrk> and with the anon struct literal syntax that is coming soon that will become actually usable in practice
<mq32> ♥
<mq32> i'm using this with enums already
<mq32> it's great
<mq32> "oh, i need some two-state local variable"
<dimenus> andrewrk: ah, yeah i was struggling with the utilization syntax
<mq32> var foo : enum { a, b } = .a;
<mq32> do we already have an issue on switch() => comptime_int ?
<fengb> enum { .true, .false, .filenotfound } 🙃
<mq32> fengb: +1
<mq32> it's really annoying to cast each switch prong to the target type
<fengb> I think this is a peer cast failure:
<mq32> especially if the target type changes
<andrewrk> something that I think will become a common pattern is: fn foo(args: struct {a: i32 = 1, other: enum{enable_thing, disable_thing} = .enable_thing}) void { ... }
<andrewrk> fengb, I'll solve this soon:
<mq32> is it okay to spice up my code with `// BAH, FOOTGUNS`? :D
<fengb> Ah okay
<fengb> I think this might be an indirect symptom but it may be fully addressed with that fix
<fengb> Geez, this release cycle is fixing everything :D
<mq32> i thought the same thing right now
<mq32> 0.6 will be a good thing. stability fixes are nice :)
return0e_ has quit [Remote host closed the connection]
return0e has joined #zig
return0e has quit [Remote host closed the connection]
forgot-password has quit [Quit: leaving]
<andrewrk> the sooner the language is stabilized, the sooner self-hosted can be a thing
<dimenus> is the anon struct literal syntax planned to land soon?
<dimenus> I might just shelve this until then
return0e has joined #zig
<andrewrk> dimenus, it's going so well, I think I can merge it today
return0__ has quit [Ping timeout: 240 seconds]
<andrewrk> at least the part when there is a result location. the part where it infers a type based on the literal values has some problems to solve
<mq32> andrewrk: is there a way to query if an async function frame is "finished"/"resumable?"
<andrewrk> mq32, no, if you need that then you are probably trying to make generators out of async functions, which is a bit of a mismatch for the semantics that async functions provide
<andrewrk> however, actual generators are a possibility
<fengb> Heh, I wrote an issue for this for making generators >_>
<mq32> i can still implement that with a simple "wrapper call" which is fn(finished:*bool) void { actualFunction(); finished.*=true; }
<andrewrk> the very short summary is that `suspend` and `yield` are fundamentally different concepts, and you might want an async generator
<mq32> but if i'm right that information *is* in the frame already
<mq32> nah i was thinking of your async chat demo
<andrewrk> it is but using it in the way you want to would be a race condition
<mq32> right now i have no idea how to remove the frame from the set without deleting the frame that is currently running or introducing some kind of "runtime list" with "stuff to delete later"
<andrewrk> assuming the async function participated in a thread pool event loop
<mq32> why that?
<andrewrk> because you're checking if it is resumable or not, but another thread may be in the process of resuming it
<mq32> ah
<andrewrk> each `suspend` corresponds to a `resume` that has to be coordinated somehow
<mq32> "resumable" was the "wrong" thing then
<mq32> "finished" is the more correct term
<mq32> so, if it's not possible to resume it anymore
<mq32> (because then no thread can resume it anyways)
<andrewrk> with "finished" the question is where should this bit live? if it's inside the frame, that's problematic because maybe the frame's memory is gone when it is finished
<andrewrk> it could work, but not generally
<andrewrk> what are you trying to do?
<mq32> understand async
<mq32> i should probably read the event loop implementation
<mq32> i understood the basics of resume/suspend, but not what "await" does in detail
<mq32> <andrewrk> what are you trying to do?
<mq32> my though is something like
<mq32> "spawn 100 async render functions" and await them in the order they finish
<andrewrk> `await` suspends and gets resumed by the awaitee when it returns
<andrewrk> if you're awaiting all of them, the order you await them in doesn't matter
fsateler has quit [Ping timeout: 240 seconds]
<andrewrk> mq32, have you seen this repo yet?
<andrewrk> check out sieve first and then factorial
<andrewrk> the factorial one demonstrates how you can take advantage of await to clean up the code
<mq32> maybe i still think too "thready" for async/await
fsateler has joined #zig
<andrewrk> think of them as functions that you can start at one callsite and finish at another one
<andrewrk> I realized the concurrency model is a lot like go's
<andrewrk> except if goroutines had return values
<mq32> hm
<andrewrk> wow, working on the self-hosted parser with the new anon struct syntax is an absolute joy
<mq32> that's good to hear :)
<andrewrk> it's way easier to refactor code around
<fengb> Goroutines also pretend like they’re like threads
<andrewrk> yeah that's a difference. goroutines have stacks
<mq32> oh that was a question i had
<mq32> will it possible to "remove" stuff from the frame with noasync?
<fengb> They also have auto inserted suspend points
<andrewrk> `noasync` is an assertion that the async function will not end up suspending at runtime
<mq32> hm, then i have discovered a bug when playing around
<mq32> because i tried to call a sync function and the compiler wanted to have an @asyncCall for that
<mq32> (sync function pointer)
lunamn has joined #zig
bhansconnect has quit [Quit: Connection closed for inactivity]
doublex has quit [Ping timeout: 240 seconds]
<andrewrk> nice find, mq32
rjtobin has joined #zig
mahmudov has joined #zig
wootehfoot has joined #zig
doublex has joined #zig
clktmr has joined #zig
<dimenus> andrewrk: just an fyi, this code doesnt' compile under your current branch:
wink_ has quit [Remote host closed the connection]
<dimenus> i realize you're still working on the branch, just through I'd point it out
<andrewrk> dimenus, the anon struct literal branch?
<dimenus> yep
<andrewrk> if you have a test case that passes in master but regresses in the branch, please do share
<dimenus> ok, let me clean this up a second
gsomix has quit [Quit: Leaving]
forgot-password has joined #zig
keithdc has joined #zig
shodan45 has joined #zig
<dimenus> andrewrk:
casaca has quit [Ping timeout: 240 seconds]
<andrewrk> dimenus, I believe this is actually a bug fix. you're missing const on []VertType
<dimenus> awesome, thanks
casaca has joined #zig
<andrewrk> good point though, I should add a compile error test for this
<andrewrk> mq32, can I (or you) post your video demo to /r/zig?
doublex has quit [Ping timeout: 252 seconds]
doublex has joined #zig
<dimenus> i'm really digging being able to use anon struct/union literals
<andrewrk> ha, grabbed the branch already?
<dimenus> yep, i'm working a basic abstraction layer over vulkan and I want to be able to just pass a description struct
<dimenus> your branch makes filling that out more 'C' like
<dimenus> are you planning on deprecating `var foo = Foo { .a = 42 }` as well?
<andrewrk> yes
<andrewrk> also planning to fix var args with this (by deleting var args)
<dimenus> why not just require a type on the LHS then?
<dimenus> ah, nvm
<dimenus> because zig can have comptime expressions that can return different types
<dimenus> so that doesn't make sense
FireFox317 has joined #zig
Akuli has quit [Quit: Leaving]
<FireFox317> Finally fixed the raspberry pi bootloader issue in clashOS andrewrk :) It was the UART1 that we were using which was causing the problem. I switched to UART0 which fixed the issue, however that one is harder to setup since there has to be some mailbox stuff done before UART0 works XD
<andrewrk> FireFox317, ah interesting. do you have the framebuffer working on real hardware?
<dimenus> are you using the latest firmware?
<FireFox317> andrewrk, Yes! But I just got it working so, don't have a PR yet :)
<FireFox317> dimenus, you mean the latest firmware that you have to put on the sd card?
<andrewrk> FireFox317, brilliant. that'll be more time over today and tomorrow to finish up #3652, which I think will make people here happy :)
<dimenus> FireFox317: yep
<FireFox317> dimenus, Yes I'm using the latest firmware
<FireFox317> Damn, the so called mini uart we were using has really small buffers of only 8 symbols, no wonder why it didn't worked
FireFox317 has quit [Remote host closed the connection]
FireFox317 has joined #zig
<frmdstryr> Does zig have any regex support in the std lib?
<andrewrk> frmdstryr, no. the closest thing we have is
<andrewrk> someday it would be neat to take advantage of comptime for regex, but that's probably too advanced for number of bugs & perf issues comptime currently has
<fengb> Closed with "still a bug but we don't want to look at it"
<frmdstryr> Thanks, that'll work
<andrewrk> fengb, they're moving issue tracking to a *forum*?
<fengb> lol... the website redirects bugs to Github issues
<andrewrk> it's really easy to explain the root cause of this weirdness. npm inc is a VC-funded, for-profit entity
<andrewrk> that's all you need to know
<dimenus> I thank the FSM weekly that I barely have to touch web technologies
<andrewrk> I'm looking forward to rewriting groove basin in zig. the time is getting nearer and nearer...
<dimenus> nice
<fengb> Is there a way to defer a suspend to "next loop"? I do that semi-often in JS for better UI responsiveness
pixlark has joined #zig
<pixlark> is there an opposite to comptime? Some sort of runtime keyword that will ensure an expression is always evaluated at runtime?
<andrewrk> fengb, this works in both async and blocking contexts: if (std.event.Loop.instance) |loop| loop.yield();
<andrewrk> related: std.event.Loop.startCpuBoundOperation();
<fengb> Ah cool
forgot-password has quit [Ping timeout: 246 seconds]
forgot-password has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
<andrewrk> this code works in my branch now:
<fengb> Is that a fully anonymous struct?
<andrewrk> yes
<andrewrk> I was looking for the isseu that will make it work without those casts too, but I didn't find it so I will file it now
<andrewrk> you can see why I don't think we need var args anymore
<dimenus> andrewrk: offtopic, but how long ago did you switch to nixos?
<andrewrk> I can answer that by finding the commit to my dotfiles repo that added nix config
<andrewrk> Date: Mon Jun 15 17:34:14 2015 -0700
<dimenus> oh wow
<andrewrk> yeah, I never looked back. this distro rules
<andrewrk> especially if you code C or C++. with zig it doesn't (or at least won't) matter as much :)
<leeward> What was the switch for `zig build test` that stuffs the test binary somewhere accessible?
THFKA4 has quit [Ping timeout: 246 seconds]
<andrewrk> leeward, you can expose an option that calls setOutputDir
<leeward> andrewrk: ah, so it's not automagic
<leeward> I get it. I think the thing I used it on was the zig build system.
pixlark has quit [Ping timeout: 240 seconds]
dimenus has quit [Ping timeout: 276 seconds]
THFKA4 has joined #zig
jjido has joined #zig
clktmr has quit [Ping timeout: 246 seconds]
clktmr has joined #zig
clktmr has quit [Ping timeout: 276 seconds]
mahmudov has quit [Remote host closed the connection]
porky11 has quit [Ping timeout: 250 seconds]
<mq32> <andrewrk> this code works in my branch now:
<mq32> neat!
<mq32> so when you deprecate varargs, this will make some really interesting formatting API!
<mq32> std.fmt.format(…, "i={i}, s={s}", .{ i=10, s="Hello, World!" });
FireFox317 has quit [Ping timeout: 250 seconds]
FireFox317 has joined #zig
<mq32> and andrewrk: sorry for that half-ass bug report. my battery died in the moment of typing it
<andrewrk> no problem, thanks for the report
dimenus has joined #zig
<mq32> i hope i never forget to report a bug
<mq32> that's the least i can do
FireFox317 has quit [Ping timeout: 265 seconds]
forgot-password has quit [Ping timeout: 252 seconds]
<daurnimator> mq32: doesn't LLVM/zig have some sort of function duplication detection/elimination thing?
<mq32> daurnimator, probably, but that will only work if the function is bit-by-bit the same
<mq32> (and it's called comdat folding in MSVC world)
<daurnimator> mq32: with the mixin approach; aren't all functions except for the inner-inner (e.g.) 'read()' function the same?
<daurnimator> I suppose excepting error sets and async vs non-async.
<mq32> hmm, good question
<daurnimator> Would error sets end up being the same function wise? I think so....
<daurnimator> so you'd really only ever just get two versions: async and non-async. which I'm okay with.
<mq32> but: this only applies if the "read" is never inlined
<andrewrk> daurnimator, we don't get async and non-async versions of anything
<andrewrk> you get 1 or the other
<daurnimator> mq32: assuming that 'comdat' happens after inlining
<andrewrk> this might help you understand noasync better
<daurnimator> andrewrk: not with mixins I think.
<andrewrk> ah
<mq32> daurnimator: afaik that comdat thing happens "at the end"
<mq32> but i don't know exacty
<daurnimator> andrewrk: depending on if your "base" function is async vs non-async; your mixin helpers will sometimes be async, sometimes non-async.