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/
<pixelherodev> ... what do you have against branches in shell?
slowtyper has joined #zig
<pixelherodev> The biggest reason I didn't Zig it was lack of networking
<pixelherodev> But now that I think about it you could just ChildProcess it
<andrewrk> yeah, anything you can do in shell you can do in zig with a handy dandy exec() function
<pixelherodev> Hmm
<pixelherodev> Idea
<pixelherodev> no wait that's a terrible idea
[rg] has joined #zig
[rg] has quit [Remote host closed the connection]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 256 seconds]
<fraktor> wilsonk: Thanks! I'll look up what that means and how to turn it off.
ur5us has quit [Ping timeout: 260 seconds]
stripedpajamas has joined #zig
ur5us has joined #zig
<satchmo_> If you do an out of bound slice access within a test, 'zig test' catches it. but if you put that access in a normal function and then build in debug, the safety checks provided by zig happen at runtime and basically aborts the program whenever a safety check fails, preventing later misuse
<satchmo_> Am i understanding zig's safety checks?
<satchmo_> well i guess tests are like running the program, so safety checks are technically always at runtime?
satchmo_ is now known as satchmo
stripedpajamas has quit [Quit: sleeping...]
<pixelherodev> I think the earlier contribution discussino can be summed up easily: "some people forget that the key word here is *contributing*; to give of yourself for collective advancement
Kingsquee has joined #zig
<pixelherodev> They focus on what *they* want to get out of it
stripedpajamas has joined #zig
<satchmo> wait no the zig test case worked cause tests are check compile-time. So safety checks are for runtime
<satchmo> i think i get it now
ave_ has quit [Quit: Ping timeout (120 seconds)]
linuxgemini has quit [Read error: Connection reset by peer]
lunamn has quit [Read error: Connection reset by peer]
lunamn has joined #zig
linuxgemini has joined #zig
ave_ has joined #zig
wozeparrot has quit [Ping timeout: 272 seconds]
[rg] has joined #zig
<andrewrk> pixelherodev, #5422 ready to merge?
aerona has quit [Quit: Leaving]
aerona has joined #zig
<pixelherodev> andrewrk: gimme one sec to check
<pixelherodev> andrewrk: yes
<pixelherodev> One of the CIs failed, but I think that was a bug on their end
<pixelherodev> Because there's no log for it
<pixelherodev> Also it's Microsoft
<pixelherodev> so that's my default assumption
<pixelherodev> "No logs available for this run" Riiiiight
fraktor has quit [Quit: WeeChat 2.8]
fraktor has joined #zig
aerona has quit [Quit: Leaving]
[rg] has quit [Quit: Konversation terminated!]
[rg] has joined #zig
[rg] has quit [Client Quit]
[rg] has joined #zig
fraktor has quit [Ping timeout: 246 seconds]
[rg] has quit [Ping timeout: 260 seconds]
satchmo has quit [Ping timeout: 256 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
<pixelherodev> andrewrk: you on? Wanted to discuss the 5422 issues
lornokto has joined #zig
<pixelherodev> Ahhh, I see from Discord; alright, later then :)
lornokto has quit [Client Quit]
lornokto has joined #zig
stripedpajamas has quit [Quit: sleeping...]
ur5us has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
Snetry has joined #zig
satchmo has quit [Ping timeout: 260 seconds]
_Vi has joined #zig
dddddd has quit [Ping timeout: 260 seconds]
cole-h has quit [Quit: Goodbye]
stripedpajamas has joined #zig
fraktor has joined #zig
greenfork has joined #zig
antaoiseach has joined #zig
antaoiseach has left #zig [#zig]
<fraktor> Is there a way to defer code that is only run in the absence of an error? AFAICT `defer` runs regardless of whether an error is returned.
<leeward> You mean like D's scope(success)?
<leeward> I don't believe so.
<lornokto> errdefer?
<leeward> errdefer runs on error, not on success
<leeward> Isn't there something in 0.6 that lets you see the error if there is one?
<lornokto> there is a catch operator that gives you error
<torque> you defer code to not run in case of an error by putting it before you return
<torque> if you have multiple places in a function that you return successful values from, that function could probably stand to be rewritten
<leeward> Yeah, I was thinking of the errdefer payload thing.
<fraktor> torque: that's fair. I was thinking of working with database stuff, and having "commit on success, rollback on failure" was the usecase I was thinking of.
<fraktor> But there should realistically only be one commit in such a case, with a couple of places for a rollback.
<lornokto> you can also create your own error state if it's needed, like var thereWasError = false; and use it in defer
<leeward> If you want to roll back each operation separately, you can errdefer after each one, then commit right before the return.
<leeward> lornokto: That sounds worse though.
<lornokto> worse than what?
<leeward> Worse than not putting the thing that would have been in a "scope(success)" block close to where it's relevant.
<torque> the "successdefer" case has been brought up in here several times, but I've never seen anyone actually post real code that would actually benefit from it
<leeward> The way I see it, the big advantage of defer and errdefer is that you can have allocation and deallocation right next to each other.
<lornokto> leeward: if you trying to solve some problem, "not " doing something wont help
leeward has left #zig ["Leaving"]
leeward has joined #zig
<leeward> lornokto: There are several ways to do what this feature would accomplish. I'm just suggesting that adding state that's twiddled inside a deferred block is not a good one.
<leeward> For what it's worth, I've never used it in D either.
<lornokto> leeward: Could you provide alternative solution instead of just forbidding the one I provided?
<leeward> lornokto: I thought I had; calling the stuff that would be there right before returning would do it.
<leeward> Refactoring the code to make it unnecessary would also do; something like wrapping the whole thing in a function and calling the relevant code if the function succeeds.
<leeward> This is a pretty abstract thing, since fraktor didn't give us a concrete example of why it would be necessary. I just have an aversion to messing with state from an outer scope without something explicit like a function parameter or return value.
<leeward> I wasn't trying to tear you down or anything.
tdc has joined #zig
<lornokto> arent defers and errefers messing with state of same scope, not outer one?
<leeward> They create scopes. The block inside the defer is its own scope just like a loop's.
<leeward> I realize this is somewhat arbitrary of me, since they exist solely to fiddle with scope from outside those blocks, but like I said, it's a taste thing.
<leeward> The idea of adding a boolean variable that can be twiddled inside an errdefer for the benefit of a different defer just smells bad to me.
<lornokto> is there some usable project in some programming language that "smells good" and has perfect code?
satchmo has joined #zig
<leeward> sure
<leeward> And that's not a reason to argue against good practice.
<leeward> I mean, we could all just use Perl, couldn't we?
stripedpajamas has quit [Quit: sleeping...]
<leeward> I understand the thing about perfect and good being enemies, but I'm not arguing for perfect; there are alternatives that are good.
<fraktor> Honestly I think just adding commit at the end is fine for my needs.
<leeward> It sounds like it.
<fraktor> If I wanted something more general I would be calling an external function anyway, in which case I could do `if (thingThatCouldFail(conn)) |_| { conn.commit(); } else { conn.rollback(); }`
<lornokto> I argue against forbidding solution in name of good practice that lead to demoralisation, infinite discussions about common good practices and totaly discourages a programmer to work at all, since actually perfect code is zero code, it has best performance and no space for bug
<fraktor> Maybe that syntax isn't exactly right, but you get the idea.
satchmo has quit [Ping timeout: 272 seconds]
<leeward> fraktor: That is a perfectly valid approach.
<leeward> lornokto: I think you're arguing against a position nobody holds.
satchmo has joined #zig
satchmo has quit [Ping timeout: 246 seconds]
satchmo has joined #zig
satchmo has quit [Ping timeout: 244 seconds]
satchmo has joined #zig
satchmo has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
satchmo has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
satchmo has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
B4s1l3 has joined #zig
B4s1l3 is now known as opDispatch
satchmo has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
satchmo has quit [Ping timeout: 265 seconds]
satchmo has joined #zig
satchmo has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
bjornroberg has joined #zig
satchmo has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
satchmo has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
satchmo has quit [Ping timeout: 272 seconds]
satchmo has joined #zig
Kingsquee has quit [Read error: Connection reset by peer]
neceve has joined #zig
satchmo has quit [Ping timeout: 260 seconds]
st4ll1 has quit [Quit: WeeChat 2.8]
satchmo has joined #zig
lornokto has quit [Remote host closed the connection]
satchmo has quit [Ping timeout: 252 seconds]
lornokto has joined #zig
satchmo has joined #zig
satchmo has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
ur5us has joined #zig
satchmo has quit [Ping timeout: 256 seconds]
satchmo has joined #zig
satchmo has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
satchmo has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
satchmo has quit [Ping timeout: 272 seconds]
satchmo has joined #zig
satchmo has quit [Ping timeout: 260 seconds]
<afontain_> Hi. I've found a problem I don't know how to solve in zig. I'd like to sort an array using a more complex sort function that takes 3 arguments.
<afontain_> Let's say it's `fn closer_of(target: i32, a: i32, b: i32) bool { return std.math.abs(a - target) < std.math.abs(b - target); }` to illustrate
<afontain_> std.sort.sort() takes a sort function that only uses two arguments, so you can't use it directly
<afontain_> In C++, I'd have used a lambda that would capture the "target" variable, or a struct that provides an operator()
<afontain_> In C, I'd resort to a GNU extension where you define a function in a function
satchmo has joined #zig
<afontain_> (^ you can still get a function pointer from it)
<afontain_> since in zig there is no function-in-function, structs that provide operator() or lambda functions, I'm a bit stuck
<afontain_> short of copying std.sort.sort from the stdlib and adapt it, using a global variable (eww, and is that even possible in zig?) or reimplementing sort, I don't really know where to look
satchmo has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
ifreund has joined #zig
satchmo has quit [Ping timeout: 260 seconds]
<ikskuh> you can probably misuse a thread_local for this
<ikskuh> have a local function that uses the thread_local
<afontain_> hmm, it's true that it seems safer than a regular global variable
<wilsonk> afontain_: https://github.com/fengb/zig-closure might work?
satchmo has joined #zig
ur5us has quit [Ping timeout: 260 seconds]
satchmo has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
satchmo has quit [Ping timeout: 246 seconds]
satchmo has joined #zig
<lornokto> cant there be some fn (target: i32, a: i32, b: 32) fn (a: i32, b: i32) that can generate function that'll fit into sort?
<ikskuh> only comptime
satchmo has quit [Ping timeout: 260 seconds]
sjm has quit [Remote host closed the connection]
<ikskuh> is it possible to somehow cast a @Vector(8, u1) to @Vector(8, u8)?
<pixelherodev> uhhh
<pixelherodev> I doubt it?
<pixelherodev> Is there a guaranteed representation of either?
<ikskuh> for the second one, es
<ikskuh> it's an array of [8]u8
<pixelherodev> If there's no defined representation of the former, then I doubt it
<pixelherodev> I mean
<pixelherodev> No explicit nop cast
<ikskuh> hm
<ikskuh> is there a way to check if a vector comparison returned "all true"?
* pixelherodev shrugs
<pixelherodev> Haven't used @Vector
<ikskuh> yeah i'm playing around with it atm
<pixelherodev> Also I'm barely awake right now
<pixelherodev> Give me like
<pixelherodev> Fifteen hours :P
<pixelherodev> I'm going to crash shortly
<ikskuh> haha
<ikskuh> get some sleep, man!
<greenfork> ye sleep is good
<ikskuh> more sleep → more code
<lornokto> good! So there's no runtime function creation
<lornokto> so you have to write a new simple sort function for that 3-arguments thing instead of hard syntax dancing for reusing existing one with two arguments
dddddd has joined #zig
lornokto has quit [Quit: Leaving]
swills has joined #zig
<alehander92> but can't you just return a closure
satchmo has joined #zig
<alehander92> ah, no closures, til
<alehander92> sorry
satchmo has quit [Ping timeout: 260 seconds]
<ikskuh> alehander92: closures would be nice, but cannot be trivially created with a non-memory-managed language
<alehander92> wow
<alehander92> i never really thought about that.
<alehander92> btw
<alehander92> if you can pass allocators everywhere
<alehander92> has anyone thought of pluggable small gc-s
<ikskuh> there is afaik an GC for zig already :D
dimenus has joined #zig
<alehander92> e.g. running a subsystem with a ref counter etc
<alehander92> hm, is it purely userland
<alehander92> like, does zig has the concept of destructors
<dimenus> alehander92: no
<dimenus> no constructors or destructors
<alehander92> so, then a gc is out of the question i guess
<alehander92> except for something hooking on defer/}
<dimenus> alehander92: ttps://github.com/yrashk/zig-rcsp
drp has joined #zig
<alehander92> but as i read in some zig issues + c++/rust : why not an anon struct + func
<alehander92> no gc required
<ikskuh> alehander92, dimenus: you can create a GC when having a special reference structure
<ikskuh> so something like
<ikskuh> to mark local variables
<ikskuh> const r = Reference.get(obj);
<ikskuh> defer r.release();
<ikskuh> r.item.foo
<alehander92> i am not sure if one can call that a gc?
<alehander92> i mean, you can just defer `free` directly
belgin has joined #zig
<alehander92> (of course, a custom `get`/`release` might do much more behind the scenes, but this can be just an allocator )
<alehander92> custom allocator
<ikskuh> alehander92: release ain't free!
<ikskuh> you need refcounting or similar on the stack
<ikskuh> as you cannot inspect the function call stack with comptime
<alehander92> but why can't one do that with a custom `free`
<alehander92> isn't it the same to do internally
<alehander92> `allocator.new(..stuff)` `allocator.free(stuff)`
<alehander92> i mean, yea, the whole reference detection stuff wouldnt work nvm
<ikskuh> alehander92: because free() is usually the operation for "release memory"
<ikskuh> not "release reference"
<ikskuh> which is a different operation!
<alehander92> yeah, you're right, sorry
<ikskuh> i can have multiple references to the same object
<ikskuh> and releasing one reference does not mean that the object is to be freed
<alehander92> so, in this case, short of hooking on `=`
<alehander92> one needs this workaround indeed
<alehander92> i can imagine passing `gc: GC` and `r := stuff //calling gc.get / defer release if gc: GC in scope, but this sounds awfully un-zig`
<ikskuh> nah, why should be do that ? ;)
<ikskuh> itÄs totally okay to have a get()+release() cycle
<alehander92> i come from a very different langdesign culture :D
<ikskuh> hm?
<ikskuh> non-obvious stuff and a lot of hidden control flow?
<alehander92> come on, it's an absolutely valid approach
<ikskuh> *grin*
<alehander92> every abstraction hides stuff
<alehander92> "oh, if hides my goto"
<ikskuh> with SSA(T) if is actually not a goto :D
<alehander92> "my goto hides what kind of actual jump instruction this is"
<ikskuh> but a phi function
<alehander92> hm, sounds too math-y to be manly
Snetry has quit [Ping timeout: 246 seconds]
<ikskuh> the idea behind it is actually really smart
<alehander92> hm?
<ikskuh> if(a) { b = c } else { b = d }
<ikskuh> => b = phi(a, c, d)
<ikskuh> the idea is that the phi function selects from a value in your SSA form which values get evaluated
<ikskuh> it also selects which side effects will be activated
APic has quit [Ping timeout: 240 seconds]
APic has joined #zig
APic has quit [Ping timeout: 260 seconds]
lornokto has joined #zig
[rg] has joined #zig
[rg] has quit [Client Quit]
[rg] has joined #zig
APic has joined #zig
layneson has joined #zig
layneson has quit [Ping timeout: 260 seconds]
lornokto has quit [Quit: Leaving]
FireFox317 has joined #zig
satchmo has joined #zig
satchmo has quit [Ping timeout: 240 seconds]
Akuli has joined #zig
decentpenguin has joined #zig
antaoiseach has joined #zig
layneson has joined #zig
antaoiseach has left #zig [#zig]
waleee-cl has joined #zig
layneson has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
layneson has joined #zig
lornokto has joined #zig
<lornokto> how to initialize [][]const u8 in code?
alexnask has joined #zig
<ifreund> lornokto: initialize with what?
<lornokto> with anything, like ["some", "thing"]
<ifreund> const foo: [][]const u8 = undefined;
<ifreund> if you don't care
<ifreund> are the values compile time known?
xackus has joined #zig
<lornokto> no
<ifreund> ok so i'll assume you have a bunch of []const u8's already allocated
<ifreund> what you need to do is allocate an array of type [_][]const u8 where _ is the number of []const u8s
<ifreund> then assign the slice of that array to your variable
<lornokto> Data is already allocated, i just want a bunch of pointers to different parts of text
<lornokto> and i think it should be possible to have those pointers without additional allocations
<andrewrk> pixelherodev, hi
wozeparrot has joined #zig
<ifreund> lornokto: if you don't know how many pointers there are, you'll still need to allocate memory to hold the pointers
<lornokto> ifreund: I could do this with [_][]const u8 {"hello", "world"} into variable and slicing that for getting [][] insted of [N][]
<ifreund> yes that's right
<ifreund> there the number of elements is comptime know
<ifreund> *known
<lornokto> well I should be able to make something like [max][]const u8 and change inner values later. I only need to remember how to initialize long arrays with same value
<lornokto> and max is runtime-known
<ifreund> const my_slice = try allocator.alloc([]const u8, max);
<ifreund> that will allocate you an array of max items of undefined value
<lornokto> i have no need for it to be heap-allocated
<ifreund> you said max is runtime know?
<ifreund> i mean you can also just stick a [1024][]const u8 on the stack if you know an upper bound
<lornokto> and cant i replace that 1024 by number that i read from stdin?
<ifreund> no, because the compiler would not know how much memory to reserve for your functions stack
<ifreund> any time the amount of memory required by something is runtime known, it must be allocated on the heap
<lornokto> and does it need to...? Ok, maybe i really need allocator
stripedpajamas has joined #zig
<lornokto> I thought functions stack size is defined by operating system and you can do anything you want with it in runtime
<fengb> The compiler needs to know how much memory is allocated
<fengb> And we don't support alloca
<dimenus> ifreund: what are your feelings of using Zig when building River?
<dimenus> I like having optional pointers, very helpful since Wayland is all async
<lornokto> can struct have a single comptime field?
<ifreund> dimenus: yes, optional pointers are huge
<ifreund> I'm also very happy that zig has @fieldParentPtr as it's pretty much a requirement to use libwayland
<ifreund> basically it comes down the fact that using the c libraries with Zig has been nearly as low friction as using them with C would be
<ifreund> and Zig has nicer things
<ifreund> and all the friction should go away as zig matures (well mostly the translate-c part)
<dimenus> ifreund: hmm, haven't needed that client side yet, but then again i'm using wayland-scanner -> translate-c
<dimenus> which isn't bad, but i have a half started zig-wayland-scanner
<dimenus> we could really tighten up the api since Wayland annotates when nulls are allowed
<ifreund> hmm? maybe it's more of a server side thing. wl_container_of is the libwayland equivalent
lornokto has quit [Quit: Leaving]
<ifreund> i'd love a zig wayland implementation for some simpler clients (e.g. my riverctl tool)
<dimenus> scope right now is a wayland native vnc client with vulkan/gl backends, but we'll see
<ifreund> don't think i'll ever get crazy enough to try to reimplement wlroots in zig though
<dimenus> I'm very bad at project focus :(
<ifreund> heh
<ifreund> you have a repo up?
<dimenus> yeah, it's very early on though, haven't implemented any of the spec yet
<dimenus> i have a bunch of vulkan code already written for another project I worked on
<dimenus> that should be fairly straight forward
<ifreund> nice, i haven't really develed into graphics programming yet myself so I'm very happy to have wlroots do it all for me
<dimenus> it's a lot more work server side, i don't blame you
<ifreund> i actually signed up to give a short talk on this on saturday for kristoff's zig stream thing
<dimenus> nice
layneson has quit [Ping timeout: 260 seconds]
<andrewrk> ifreund, I'm looking forward to that :)
<fengb> Great minds unite!
slurpie has quit [Ping timeout: 265 seconds]
<fengb> kubkon is doing amazing work
wozeparrot has quit [Remote host closed the connection]
satchmo has quit [Ping timeout: 265 seconds]
wozeparrot has joined #zig
[rg] has quit [Remote host closed the connection]
satchmo has joined #zig
<andrewrk> yeah!
<ifreund> nice, maybe in 100 years we won't need javascript anymore
<fengb> JS is dead. Long live JS
<dimenus> the mainframe is dead, long live the cloud!
cole-h has joined #zig
<alehander92> what is the zig stream thing
greenfork has quit [Ping timeout: 265 seconds]
wjlroe has quit [Ping timeout: 244 seconds]
<ifreund> alehander92: kristoff is hosting a couple of zig talks on saturday at 20:00 CET
<ifreund> fengb and I are the speakers for this first event
<ifreund> his twitch is here if you want to tune in :) https://www.twitch.tv/kristoff_it
<companion_cube> 20h CET is in a bit more than 1h, isn't it?
wjlroe has joined #zig
<ifreund> companion_cube: not today, saturday
<ifreund> sorry
<ifreund> but yes that would be correct
<companion_cube> ah yes ok
<andrewrk> it should be fun - Loris has put a lot of effort into the production values of the event
guan has quit [Read error: Connection reset by peer]
<alehander92> awesome: will keep it in mind
betawaffle has quit [Ping timeout: 246 seconds]
guan has joined #zig
wjlroe has quit [Ping timeout: 246 seconds]
betawaffle has joined #zig
wjlroe has joined #zig
betawaffle has quit [Max SendQ exceeded]
wjlroe has quit [Ping timeout: 260 seconds]
guan has quit [Ping timeout: 264 seconds]
betawaffle has joined #zig
dimenus has quit [Quit: WeeChat 2.8]
wjlroe has joined #zig
guan has joined #zig
bjorob has joined #zig
dimenus has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
bjornroberg has quit [Quit: leaving]
<andrewrk> yooo look at this: https://github.com/ziglang/zig/pull/5442
<dimenus> :o
<dimenus> andrewrk: noice!
<leeward> shiny
<andrewrk> if you look at the diff it's very ziggy
doublex has quit [Ping timeout: 260 seconds]
<andrewrk> like, go ahead and try to do that in c++
<andrewrk> returning anonymous struct from a comptime block is amazing
<fengb> Wait till you meet #1717 :P
<dimenus> why are people so excited about #1717?
<ifreund> \o/ that's a nice throughput bump
<ifreund> dimenus: cause it's cool :P
<dimenus> wasn't there another issue about renaming const to something else?
<dimenus> eg let?
<fengb> Lol
<alexnask> oh no
doublex has joined #zig
<alexnask> ^
<alexnask> Was just about to post this lol
<dimenus> lol
ifreund has quit [Read error: Connection reset by peer]
ifreund has joined #zig
<FireFox317> Neat andrewrk!
waleee-cl has joined #zig
<ikskuh> andrewrk: neat! It's also a really small change with a huge effect :)
FireFox317 has quit [Quit: Leaving]
<ifreund> anyhow know offhand how fast C or C++ tokenizers are?
<ifreund> *anyone
<pmwhite> yeah, they're typically 354 MB/s, so we have some more work to do.
<pmwhite> jk, i doubt that the speed of your tokenizer has much to do with the language you're tokenizing.
<ifreund> no it likely doesn't. I was just assuming that C/C++ tokenizers would likely be the most mature/fast
<pmwhite> yeah, that's true. It would be nice to know what throughput is really good.
doublex has quit [Read error: Connection reset by peer]
doublex_ has joined #zig
<companion_cube> it would make sense that C++ has super fast tokenizers, given that a typical compilation goes through gigabytes of .h files…
<ikskuh> yep
[rg] has joined #zig
<leeward> Along the same lines, Zig's tokenizer speed probably doesn't matter much.
<ikskuh> leeward: anyways, the slowest component defines the compilation speed
<leeward> Right, and the tokenizer is never going to be that.
<ikskuh> also, faster single components makes faster compilation
<companion_cube> +1 leeward
<andrewrk> yeah I don't think it matters much. tbh I was just happy the compiler didn't crash when I did all that comptime stuff :P
<pmwhite> Keep up the mastodon tooting, andrewrk! I don't Twitter, so I appreciate it
slowtype1 has joined #zig
slowtyper has quit [Ping timeout: 246 seconds]
<andrewrk> okie dok
<companion_cube> oh, where is that?
<companion_cube> oh wait, you have 2 accounts?!
<companion_cube> mastodon.social I guess
<andrewrk> @andrewrk@mastodon.social
<companion_cube> thanks, already found it
<companion_cube> turns out the search feature works even in the federation, I'm surprised
opDispatch is now known as B4s1l3
B4s1l3 is now known as opDispatch
<andrewrk> wtf, I showed this comptime tokenization thing to drew devault and his response is "you're just showing off" "performance is not the ultimate goal" "really, the answer is be happy with 279 MiB/s" and "not much more compelling than just pregenerating this data in a build step"
<andrewrk> idk what world this man is living in, but I hope if he ever makes a programming lanugage, his users know what they're getting themselves into
<BaroqueLarouche> dafuq
<companion_cube> andrewrk: don't you know he's making a programming language? :DDD
<companion_cube> (also, remember to not use threads)
<leeward> I mean, it does seem like you are showing off. It's a cool thing you can do with Zig.
<ifreund> yeah, you have the right to show off :D
<leeward> And the fact that the performance difference isn't important here doesn't make it less cool.
<ifreund> right
<ikskuh> andrewrk: you ARE showing off, but it's damn awesome to show someone that you can do stuff in-language that other people need two or more precompilation steps for :D
<andrewrk> yeah damn right I'm showing it off, it took a lot of work to get here!!
<ikskuh> 👍
<andrewrk> I'm just shocked at the response "you shouldn't try to make it that fast"
<ikskuh> yes, true.
<ikskuh> i was also like "WAT"
neceve has quit [Ping timeout: 256 seconds]
<nephele> i certainly agree, zig is too fast, please make a slower language so i can read the compile log ;)
<andrewrk> ugh whatever. alright, I think I made enough progress on PRs today to justify some more self-hosted work :)
<ikskuh> heh, i should take a look which you merged :D
<ikskuh> > Merge branch 'daurnimator-pretty-print-non-exhaustive-enums' …
<ikskuh> whooo!
<nephele> self hosted zig is so cool
<nephele> I hope to use it to put code on a floppy for my ibm laptop at some point :P
<ikskuh> hehe
<ikskuh> what IBM?
<nephele> IBM Portable Personal Computer, the bulkiest laptop i onw
<fengb> Business machines
<shakesoda> andrewrk: that's a bizarre reply when more performance is obviously better
<shakesoda> besides, it can still go faster ;)
<andrewrk> yes
<companion_cube> well, drew devault likes simplicity above all
<andrewrk> I promised everyone that zig will be faster than jai. "whatever jai's performance is, we'll beat it"
<shakesoda> companion_cube: simplicity and performance are usually correlated
<andrewrk> just waiting for it to be available, for comparison
<companion_cube> https://drewdevault.com/2020/05/15/Status-update.html <-- if you unfold the bottom "…" you can see a preview of his language
<shakesoda> certainly not the same thing, but correlated
<companion_cube> meh, depends
<shakesoda> i say this, specifically, as someone who's day job is optimizing stuff
<shakesoda> a lot of what i end up *actually* doing is simplifying
<companion_cube> "too simple" is slower than "reasonably simple but still optimized"
<companion_cube> yeah but here, the lexer andrewrk is optimizing would be simpler without the optims, wouldn't it?
<shakesoda> yes, it's more nuanced than just simpler = better
<andrewrk> companion_cube, you could make the argument that it actually is a simplification, because all the logic is in the getKeyword function, and the keywords list can be changed to simple struct inits now instead of precomputing a hash
<companion_cube> you could also have a basic hashtable
<companion_cube> it'd be slower, but still work
<andrewrk> I'm saying that you could make the argument that this is simpler than that
<andrewrk> also, Vexu did that and it's very close in perf, nearly as good
<companion_cube> oh, interesting.
<andrewrk> the key insight seems to be that it's common for something to *not* be a keyword, and doing the hash function in that case is unnecessary work
<fengb> You should add sleep(1000ns) to satisfy him
<companion_cube> clearly it's SIMD tokenizer or GTFO
<companion_cube> (can't wait to see his language, really, I think it's basically a revamping of C)
<shakesoda> simd, cache optimized, threaded as is appropriate... the works!
* shakesoda fast forwards to 2038, finds zig compiler has achieved speed of light
<companion_cube> ludicrous speed
<shakesoda> it makes me incredibly happy every time that nsight has an actual speed of light metric
<shakesoda> and, true to its name, is quite hard to approach
tdc has quit [Ping timeout: 256 seconds]
Aransentin has joined #zig
<Aransentin> For a 4Ghz CPU, light travels ~7.5 cm each cycle. Kinda makes you appreciate how fast modern computers are.
<ikskuh> Aransentin: yeah! I calculated that value as well and it's crazy
<ikskuh> now divide by ~3 and you get distance in an electrical medium
<ikskuh> so, processors can't really get much bigger (or faster)
ur5us has joined #zig
<dimenus> i appreciate Drew for most of his stances but that just strikes me as whiny
<leeward> I don't know if I'd say they can't get much bigger or faster; it's just an engineering challenge we haven't solved yet.
<ikskuh> leeward, it's not that easy sadly
<ikskuh> if we get smaller, the transistors start to get unreliable
<ikskuh> and we haven't solved 3D design yet
<ikskuh> bigger means that you cannot reach the other side of the chip in one cycle
decentpenguin has quit [Quit: decentpenguin]
<ikskuh> the solution for that is what AMD does: Chiplets
<ikskuh> make more chips instead of bigger chips
<nephele> I think it is amazing how fast modern computers are, and how inefficient some oses run on it :3
<ikskuh> nephele: SO TRUE
<andrewrk> 3D design! there's a theoretically possible idea, but seems impossible in practice
<ikskuh> andrewrk: yep
<ikskuh> some companies trie to do for memory chips
<andrewrk> what about like an X shape
<ikskuh> wdym?
<andrewrk> instead of a cube
<leeward> ikskuh: I'm not saying it's easy, just that it's not impossible. 3D design is a problem of heat dissipation. If we can improve our manufacturing processes for materials with better properties, it'll be doable.
<shakesoda> i await seeing the crazy solutions from people far, far, far smarter than i
<leeward> Optics are also a potential path, but there are plenty of problems to be solved there too.
<ikskuh> optics will probably yield a factor 3 in speed
<andrewrk> we need subatomic transistors
<ikskuh> aat least in transmission speed
<leeward> Parallelism is a thing too. Modern processors don't live by themselves; it's not super important for one core of a multicore chip to be able to send a signal to another in a single clock cycle.
<Aransentin> "Don't embed an entire browser to render your basic desktop app" is also a potential solution to improve performance :)
<ikskuh> that's what i said ;)
<leeward> I worked on a 64-core chip once, and messages passed across the mesh at 1 chip per cycle.
<leeward> I can read!
<ikskuh> :D
<leeward> Aransentin: The problem is that software developers have been trained by 40-odd years of "wait 2 years and the hardware will be faster" so most people don't think much about efficiency.
<companion_cube> Aransentin: so true
<ikskuh> the probably most popular cpu that uses such a design is this: https://blogs-images.forbes.com/antonyleather/files/2019/08/threadripper.jpg
<companion_cube> and don't write big apps in JS, either
<BaroqueLarouche> Programmer productivity is favored over performance
<andrewrk> I think that cross platform guis are just a fundamentally difficult problem
satchmo has quit [Ping timeout: 265 seconds]
<leeward> BaroqueLarouche: In most domains; unfortunately not the ones I tend to work in.
<fengb> I mean, we lost so much performance switching towards preemptive OSs
<ikskuh> andrewrk: just remove "native" guis and let everyone render with vulkan!
<fengb> So let's go back to the good old days
<andrewrk> ikskuh, I actually think that's not so bad
<companion_cube> fengb: did we now? :D
<BaroqueLarouche> most pro applications do this anyway, render their own GUI
<ikskuh> me neither, but window management is still a problem
<companion_cube> I'm glad that even if a badly written program (cough slack cough) misbehaves, I can kill it
<companion_cube> and the OS will cleanup
<ikskuh> but just give each application a fullscreen buffer as a render target and go!
<fengb> Hard part of GUIs isn't rendering but layout and synchronization
<leeward> fengb: You mean like classic MacOS and constant crashes because someone forgot to yield?
<fengb> Yeah exactly. Super awesome
<leeward> Good times.
<ikskuh> fengb: but those are user space problems anyway
<dimenus> andrewrk: agreed on GUIs
<ikskuh> nothing that is a problem with multiplatform
<andrewrk> IMO the hard part of guis is the cross platform part. are you going to use windows widgets? gtk? qt? render your own stuff? does the gui toolkit require you to use C++?
<ikskuh> andrewrk: the answer is: yes, you need C++
<ifreund> ikskuh: that's roughly how wayland works, though there are a lot more details :P
<ikskuh> or you use gtk, which isn't zig compatible as well
<ikskuh> ifreund: yeah, i know :D
<fengb> DOM os crossplatform
<ikskuh> window decorations are a thing as well
<fengb> is*
<ifreund> nah, ssd for the win
<alexnask> ikskuh The Gtk3 experiment didnt go well I assume? :P
<companion_cube> that's the future Zig killer app: a portable GUI framework that doesn't make you depend on C++
<companion_cube> :p
<andrewrk> right, so the fact that you are forced to use C++, which isn't inherently a GUI related concept, is evidence of cross platform GUIs being hard
<ikskuh> alexnask: didn't had time yet
<fengb> I've never used a cross platform UI kit that behaves well
<alexnask> ikskuh, Ah ok the "which isn't zig compatible as well" made me think you hit some roadblock
<andrewrk> Qt is pretty good. but that's a hulking behemoth
<ikskuh> Qt is actually really good considering all other options :D
<ikskuh> it's not zig-compatible out-of-the-box
* ikskuh looks at 25MB of DLLS
FireFox317 has joined #zig
<BaroqueLarouche> Qt is such a pain to bind
<fengb> At the end of the day, JS DOM solves a bunch of problems, and it's usually not JS that makes it slow
<andrewrk> yes, and this is why we have to deal with electron, not because the kids need to get off our lawns
<ikskuh> soooo. zig-based crossplatform UI based on vulkan and a MVVM/DOM model?
<andrewrk> I want a visual form builder like VB6 / .net / Qt
<fengb> InterfaceBuilder :3
opDispatch has quit [Ping timeout: 240 seconds]
satchmo has joined #zig
opDispatch has joined #zig
<ikskuh> andrewrk: you and your wishes!
<ikskuh> but yeah, seems like zig-window is the first step to that
<nephele> not only portable to architectures and oses, also portable to windowing toolkits :P /s
<ikskuh> i'd actually like a non-"native" window toolkit
<ikskuh> makes programming applications more persistent
<dimenus> i'm doing vulkan / wayland wsi etc right now :)
<nephele> Hmm, when is a toolkit native? I would think qt is basically nowhere native
<waleee-cl> ikskuh: re mvvm, well there's this in rust-land
<shakesoda> doesn't qt actually use native widget drawing when it can
<shakesoda> particularly on windows
<BaroqueLarouche> when you can get the HWND handle of a button when on WIndows
<ikskuh> shakesoda: afaik not
<shakesoda> ok
<ikskuh> otherwise some stuff would look like win10/win9
<ikskuh> win9x
<ikskuh> and the rest would be qt-style
<companion_cube> I want the gui toolkit of serenity OS
<companion_cube> with the look and feel of win98
<shakesoda> i want widget kits to give up on their notions of being some kind of universal and actually just give up in general, give me my windows 2000 ui back
<shakesoda> and stop halfassing it because some platforms are different ;)
<ikskuh> i love the win9x look
<shakesoda> it is pure function
<companion_cube> :DDD
<ikskuh> could use better color schemes though :D
<shakesoda> i'm using it right now
<shakesoda> specifically win7 classic since it's as old as i can go without things being extremely busted trying to use it in the current world
<nephele> Heh, native toolkits can be quite nice though :D, aslong as they dont try to port everywhere
st4ll1 has joined #zig
<shakesoda> but i keep my win2k vm ready to go at all times
<ikskuh> <nephele> Heh, native toolkits can be quite nice though :D, aslong as they dont try to port everywhere
<ikskuh> that's kinda a contradiction
<shakesoda> i found that with kernelex/hacked in winxp stuff it happily builds and runs luajit
<ikskuh> qt isn't native, WinAPI is
<ikskuh> for X11, there's no "native" u
<shakesoda> and also sublime text
<ikskuh> *ui
<nephele> ikskuh, well, if you don't have any native toolkit then any is native? :)
<nephele> I wouldn't know what a native linux toolkit is, they all seem to try to be ported everywhere
<shakesoda> i feel like gtk is the closest to native linux
<shakesoda> including in that on no other platform does it feel even remotely at home
<ikskuh> nephele: linux doesn't really have a *native* tk
<ikskuh> but all other major systems (mac, windows, android, ios, winphone) have
<shakesoda> linux doesn't have a native de to begin with, so it kind of can't
<ikskuh> i really like the looks of modern GTK applications
<nephele> ikskuh, yeah
<ikskuh> the header bar is *great*
layneson has joined #zig
<shakesoda> modern gtk stuff usually looks decent and has serious functionality and performance problems
<nephele> i for one dislike gtk3s ui.. much more happy with Haikus :P
<shakesoda> which is very frustrating.
<Aransentin> Native Linux: https://i.imgur.com/9eoINvG.png :P
<shakesoda> that's just x11 though
<ikskuh> Aransentin: lol yes
<nephele> Aransentin, heh... but openbsd actually has X11 in base
<nephele> for linux it's all "addon" software :D
<shakesoda> i was very happy with gtk2's ui, lots of gtk3 software feels chaotic and missing stuff now
<THFKA4> i'd like to interject for a moment..
<shakesoda> and headerbars are worse than menus in almost all ways
<shakesoda> but in general i think the macos global menu gets *that* right
<shakesoda> that only has so much weight though, or my favorite os wouldn't be win2k
<shakesoda> i do give very high marks to macos 10.4 and 10.6 though
Akuli has quit [Quit: Leaving]
slurpie has joined #zig
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #zig
layneson has quit [Ping timeout: 272 seconds]
doublex_ has quit [Read error: Connection reset by peer]
doublex has joined #zig
<Aransentin> Here's an a fun "kids get off my lawn" moment I had this week: check out the build instructions for the new JPEG standard ("XL") reference lib: https://gitlab.com/wg1/jpeg-xl
<Aransentin> Step 1: Install Docker
<Aransentin> Also their official docker container with the build environment is hosted on Dockerhub, so you need sign up for a Docker account.
<Aransentin> What happened to `./configure && make` grumble grumble...
<fengb> lol, didn't andrewrk make a video on replacing autotools?
satchmo has quit [Ping timeout: 260 seconds]
<dimenus> containers are the new base layer
<dimenus> containers and chromium
<dimenus> i should switch to NixOS...
<BaroqueLarouche> The Road to Zig 1.0 talk is the reason that I'm here
<alexnask> docker for a build? seriously?
<shakesoda> that's pretty common now
<leeward> It's popular for CI
<companion_cube> cna't wait for "here's the wasi image" instead
<shakesoda> takes away tons of variables
<fengb> Yeah, reproducible builds are hard. Maybe everyone should switch to Nix instead
layneson has joined #zig
<pixelherodev> andrewrk: hi
<leeward> Silly tools putting build times in binaries...
[rg] has quit [Ping timeout: 260 seconds]
dimenus has quit [Ping timeout: 256 seconds]
[rg] has joined #zig
[rg] has quit [Remote host closed the connection]
layneson has quit [Ping timeout: 265 seconds]
xackus has quit [Ping timeout: 256 seconds]
dimenus has joined #zig
<FireFox317> andrewrk, what is the reason for not using llvm's calling convention and doing it our selfs? this is regarding the c abi issue. Because im not seeing any attributes regarding calling convention in llvm-ir
satchmo has joined #zig
satchmo has quit [Ping timeout: 260 seconds]
Aransentin has left #zig [#zig]
squeek502_ has quit [Quit: Leaving]
squeek502 has joined #zig
traviss has joined #zig
layneson has joined #zig
ifreund has quit [Ping timeout: 240 seconds]
nycex has quit [Ping timeout: 240 seconds]
nycex- has joined #zig