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/
lunamn_ has joined #zig
_Vi has quit [Ping timeout: 272 seconds]
lunamn has quit [Ping timeout: 272 seconds]
metaleap has quit [Quit: Leaving]
<andrewrk> yeah it's a good change
<daurnimator> should merge it ;)
<andrewrk> I have to review the code first
ave_ has quit [Quit: Connection closed for inactivity]
<andrewrk> @_@ 15 new issues in 2 days
<fengb> "error - detected leaked allocations without matching free: 268435456" I don't think this is right
i_right_i has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
ForLoveOfCats has joined #zig
LER0ever has joined #zig
ForLoveOfCats has quit [Quit: Konversation terminated!]
ur5us has quit [Ping timeout: 240 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
ur5us has joined #zig
<fengb> Hmm, 2863311530 == 0xAAAAAAAA
LER0ever has quit [Ping timeout: 265 seconds]
LER0ever has joined #zig
<fengb> Oh I remember this. It's an LLVM design flaw for wasm -_-
<andrewrk> what's that?
<fengb> I'm not sure why this isn't the default option
<andrewrk> ah now I see why you were reading about guard pages
<fengb> I was actually trying to figure out where the wasm stack should live. THis was a byproduct of me poking around >_>
<fengb> Trying to actually get my VM executing stuff. I keep getting bogged down by details
<fengb> Setting undefined to 0xAA really helped debugging that :P
<andrewrk> so --stack-first makes the stack grow upwards instead of downwards? that's interesting
<fengb> I think it just swaps where the global is. So stack starts at global bottom and goes downward
<andrewrk> oh! that's perfect
<fengb> So there wouldn't be a chance of memory corruption but instead just blow up immediately
<fengb> Which makes the default behavior... a really confusing default
<andrewrk> do you know how to mess with the linker lines that zig emits?
<andrewrk> it's one of the most straightforward parts of the compiler to work on
rjtobin has quit [Quit: Leaving]
<fengb> I think so. I remember finding the elf stack size definition at one point
<andrewrk> if you look at construct_linker_job_wasm it should be fairly clear
<fengb> Great 👍
<andrewrk> alright I think I owe people a bunch of bug fixes & PR merges
<andrewrk> but first I owe myself some chocolate and video games
<andrewrk> that self-hosting libc detection and dynamic linker detection kicked my butt
<fengb> I think you owe yourself a good rest
ur5us has quit [Ping timeout: 240 seconds]
<andrewrk> fengb, how's the vm coming along?
LER0ever has quit [Ping timeout: 265 seconds]
LER0ever has joined #zig
marmotini_ has joined #zig
ur5us has joined #zig
marmotini_ has quit [Remote host closed the connection]
plumm has joined #zig
plumm has quit [Ping timeout: 265 seconds]
dddddd has quit [Ping timeout: 272 seconds]
betawaffle has quit [Remote host closed the connection]
betawaffle has joined #zig
ur5us has quit [Ping timeout: 240 seconds]
_Vi has joined #zig
ave_ has joined #zig
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen1 has joined #zig
dingenskirchen1 is now known as dingenskirchen
_Vi has quit [Ping timeout: 272 seconds]
return0e has joined #zig
Xatenev has joined #zig
ur5us has joined #zig
ifreund has joined #zig
alexnask has joined #zig
notjones has joined #zig
marmotini_ has joined #zig
marmotini_ has quit [Ping timeout: 268 seconds]
waleee-cl has joined #zig
ur5us has quit [Ping timeout: 240 seconds]
losinggeneration has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
zfoo_ has joined #zig
_Vi has joined #zig
shakesoda has joined #zig
decentpenguin has joined #zig
<fengb> Um... I translated most of the op codes and that’s about it :P
zfoo_ has quit [Ping timeout: 260 seconds]
LER0ever has quit [Remote host closed the connection]
slowtyper has quit [Quit: WeeChat 2.7]
slowtyper has joined #zig
frmdstryr has joined #zig
utzig has joined #zig
dddddd has joined #zig
marmotini_ has joined #zig
zfoo_ has joined #zig
ScottJMaddox has joined #zig
ScottJMaddox has quit [Remote host closed the connection]
metaleap has joined #zig
TheLemonMan has joined #zig
<TheLemonMan> yo, is any windows user able to reproduce the test failure in #4497 ?
<TheLemonMan> my windows VM is extremely slow and getting Zig to compile is gonna take too much time
<shakesoda> can i use comptime stuff to generate symbols to export
<shakesoda> i'm trying to figure out what i can do to approach exporting stuff with this crazy macro-powered name mangling that haxe's hashlink libraries need
<TheLemonMan> sure thing, @export allows you to set the external name for every symbol
<shakesoda> wonderful, looks like exactly the tool for the job, i will see where this path leads
<shakesoda> thanks
<andrewrk> I think @bytesToSlice and @sliceToBytes can be removed from the language in favor of functions written in zig
<TheLemonMan> outstanding idea, that saves me the need to find out why the PR is erroring out heh
<fengb> That'd make sense, especially since `asBytes` and `bytesAsValue` are already there
<fengb> `testing.expect(codeface.* == 0xC0DEFACE);` I think someone was having fun
marmotini_ has quit [Remote host closed the connection]
marmotini_ has joined #zig
daurnimator has quit [Ping timeout: 272 seconds]
marmotini_ has quit [Ping timeout: 260 seconds]
<shakesoda> does zig have a good way to alias types such that the two types won't be compatible without at least an @as, or should i do something like have a struct/union with a single field
<andrewrk> alright well it's up for grabs then: https://github.com/ziglang/zig/issues/4499
<andrewrk> if anyone wants those sweet deletions on their commit record
<andrewrk> shakesoda, you would need the struct/union with single field. Here's the proposal for that: https://github.com/ziglang/zig/issues/1595
<shakesoda> andrewrk: thanks
daurnimator has joined #zig
marmotini_ has joined #zig
Xatenev has quit [Remote host closed the connection]
<TheLemonMan> sigh, trying to find the problem with the windows build by trial and error is going to take a lot of time
<TheLemonMan> every CI build takes ~10 mins
return0e has quit [Remote host closed the connection]
<andrewrk> you need some dedicated windows hardware
<fengb> andrewrk: can Pinephone run the nightly build?
<andrewrk> I gave my pine phone to rich felker
FireFox317 has joined #zig
<fengb> Oh... that useful huh? 🙃
<andrewrk> I saw a screenshot of someone else running the nightly build
<FireFox317> TheLemonMan, I could help you, have a windows machine here
<FireFox317> well currently I'm on linux, but i have a dual boot
_Vi has quit [Ping timeout: 272 seconds]
<TheLemonMan> FireFox317, oh that'd be cool (and it'd avoid me to install windows on this lappy)
<FireFox317> one moment, have to boot, and build zig on windows :)
FireFox317 has quit [Remote host closed the connection]
FireFox317 has joined #zig
<FireFox317> on windows only a release build of zig is possible right?
<mikdusan> pretty sure you can get a Debug build _if_ you build against a debug build of llvm
<BaroqueLarouche> If you want a debug build, you need to build LLVM and Clang yourself
waleee-cl has quit [Quit: Connection closed for inactivity]
<TheLemonMan> ouch
<FireFox317> hmm, thats annoying
<FireFox317> someone has a debug build of llvm for windows 10 laying around? :)
<fengb> Maybe a dumb question... is glibc a core part of GCC?
<jwh> no
<mikdusan> FireFox317: are you building llvm debug yourself? important to use -DLLVM_USE_CRT_DEBUG=MTd as shown here:
<FireFox317> mikdusan, nah i was trying to help TheLemonMan, and using a debug build is also fine now
<FireFox317> but thanks for the help :)
<andrewrk> on windows a debug build is basically only useful for one-off debugging things
<andrewrk> in practice you would need both release and debug builds of llvm/clang
<andrewrk> which is a lot to ask for from your hard drive
<andrewrk> TheLemonMan, you were so right about looking for .s extension way back ago
<TheLemonMan> hah there's still time to adopt that behavior
<andrewrk> yeah that's #3508
<TheLemonMan> how many more breaking changes can we cram in 0.6 is still unknown :P
_Vi has joined #zig
marmotini_ has quit [Read error: Connection reset by peer]
<fengb> All of it!
<BaroqueLarouche> break ALL the things!
ForLoveOfCats has joined #zig
<metaleap> heh `@compileLog(@TypeOf(someFn).ReturnType.ErrorSet);` outputs "@TypeOf(someFn).ReturnType.ErrorSet"
<betawaffle> heh
<TheLemonMan> it's not wrong nor right
<betawaffle> but that's what the type name *is* for inferred error set types
<betawaffle> if you give it an explicit name, it will probably show that
<metaleap> betawaffle: well i didnt ask for @typeName
<metaleap> guess its not a deeply-traversing-anything fmt-print yet
<betawaffle> i think the way a `type` is logged is with the @typeName
<metaleap> true
<fengb> You can use std.fmt.bufPrint() at comptime to use fmt.format
<fengb> Speaking of which, is there an easier way to work with error sets? I ended up rolling my own: https://github.com/fengb/korwerdna/blob/master/src/op.zig#L160
<metaleap> oh neat, somehow i only had fmt.printAlloc in mind but with bufs itd work
<fengb> Note: bufPrint only uses a slice... I'm starting to wonder if we should rename std.Buffer
<betawaffle> also speaking of error sets... i think i may have found a bug recently
<metaleap> fengb: so much of this (incl my above usecase) can be userland-rolled that i suppose more commonly needed things will keep arriving into std.meta
<betawaffle> i think the compiler might have trouble with inference when peer-type resolution is involved?
<betawaffle> let me make an example
<ForLoveOfCats> Potentially dumb question: Is it possible to build a struct at comptime with some sort of loop? I am trying to take a `[]FnArg` and package it up as a type which can be passed to `@call` (I'm wrapping std.Thread.spawn to allow me to pass more than one arguments as an anonymous struct)
<betawaffle> in that, foo would be inferred to have an empty error set (it seems), and bar would not
<betawaffle> am i missing something?
<betawaffle> or is that a bug?
<andrewrk> ForLoveOfCats, your issue is #383
<betawaffle> ForLoveOfCats: not currently possible to build a new struct at comptime
<ForLoveOfCats> So there is a compiler limitation on this and it is different from what ArrayList(T) does by returning a struct at comptime?
<betawaffle> you can make structs at comptime, just not with comptime-dynamic fields/decls
<ForLoveOfCats> That's what I thought you meant, thanks for clearing that up
<metaleap> well for decls there was some abusingnamespace hackery floating around but .. yeah =)
<betawaffle> metaleap: i'm still not sure i'd consider that comptime-dynamic
<metaleap> yeah couldnt do it in a loop or such i guess
<metaleap> still, conditional decls. it's something. if one is into that sorta thing
<betawaffle> oh?
<metaleap> dont remember how that worked but usingnamespace was involved and its operand was comptime-decided to be empty struct or struct-with-stuff. might have been outdated too
<betawaffle> metaleap: oh, that's clever
<metaleap> fengb just found it (or another example of "it")
<fengb> This file has some pretty amazing usingnamespace hacks
mahmudov has joined #zig
<metaleap> ah yeah L294 has the "conditional decl" example
<fengb> Silly aside: the Z suffix looks like it's for Zig instead of zero terminated strings >_>
<companion_cube> https://www.youtube.com/watch?v=449j7oKQVkc <-- function colors again!!
<andrewrk> fengb, that's just an added bonus ;)
<betawaffle> i really wish zig had a "flags" type that could be used in the way enums are often abused in C
<fengb> Oh is this guy `pron` on HN?
<fengb> betawaffle: packed structs
<andrewrk> oh wow nice connection fengb
Akuli has joined #zig
<betawaffle> that's not very fluent, and it's difficult or impossible to convert to that from a C enum
<ForLoveOfCats> Is there any hack that will allow generating the name of a struct field's name? (I'm headed down a rabit whole with the `pub usingnamespace` hack)
<companion_cube> fengb: yes
<ForLoveOfCats> *hole
<fengb> *rabbit
<fengb> I need a troll emoji
<mikdusan> fengb: we already have a troll emoji. it's `fengb` :P
<fengb> Fine, I need a serious emoji
<andrewrk> betawaffle, in my experience regular ints with constants work pretty fine for flags, same as C
<companion_cube> 🤔 does the job fengb
<betawaffle> yeah, they work "fine" but you don't get any type safety
<andrewrk> but yeah align(0) fields (#3802) would be the ziggy type safe way to do it
<andrewrk> fengb, this guy looks exactly like me
<companion_cube> andrewrk == pron??
<fengb> Well that explains all the Zig propaganda from his HN account /fengb
<companion_cube> nice use of /fengb /s
<andrewrk> maybe the discord channel will add a custom fengb emoji
<andrewrk> on IRC you would have to get it into the unicode standard
<companion_cube> or make your IRC client rewrite ":fengb:" into some picture
<fengb> 💩
<andrewrk> me: monads are too hard to understand
<andrewrk> also me: skipping the part of the video where he explains how monads work
<fengb> Since I’m basically shitposting anyway
<fengb> Hmm I think I’ve seen this. Is this where he proposes CPS as a solution?
<companion_cube> wait until he reaches callback hell
<companion_cube> tbh it's a good presentation of monads from a concrete point of view
<companion_cube> it's all about the executor
<andrewrk> ok I sat through monad explanation. still do not understand
<fengb> Which is funny... because a stackless async is kind of a style of CPS
<betawaffle> andrewrk: monads are for *mumble mumble mumble*
<andrewrk> wait, an error union is a monad?
<companion_cube> `Result<T,E>` is a monad for a fixed E, yes
<fengb> Anything is a monad if you squint hard enough
<companion_cube> lol, no
<companion_cube> but clearly, Option/Result/List/Future are good examples
<fengb> Optionals, promises, Linq
<companion_cube> … yes? :D
FireFox317 has quit [Remote host closed the connection]
<companion_cube> it'd be funny if the things he presents about scoped continuations were equivalent to zig's async
<andrewrk> I hate that "then" pattern that js has
<andrewrk> 18:20
<andrewrk> IMO callbacks are better than that
<fengb> Disagree. Callbacks can't capture state and compose correctly
<companion_cube> andrewrk: don't worry, he gets on with better solutions
<fengb> So you end up having some weird hack to prevent multi-firing
<companion_cube> let imperative langs be imperative!
<fengb> But I do agree with that
FireFox317 has joined #zig
<fengb> Except... his version of continuations brings back my PLC nightmares
<fengb> andrewrk: I read that. It's not about organization as much as flow handling
<fengb> Callbacks can't capture "once-and-only-once" without a bunch of hacks, e.g. exception handling
<andrewrk> doesn't the "then" thing have the same flaw?
mattmurr has joined #zig
<companion_cube> no, promises are eval-exactly-once normally
<fengb> No, promises guarantee that each body pair then(success, failure) only runs once. It's actually really hard to get it to run multiple times
<andrewrk> I strongly agree with this pull > push thing
<andrewrk> fengb, I see, I did not know that!
<fengb> Also promises are highly composable. Callbacks... are a wild west there
<companion_cube> anecdota: in OCaml, people work on a multicore runtime, and they have delimited continuations like in this talk… it's quite modern
<betawaffle> i really wish i could post-process a c import from zig
decentpenguin has quit [Quit: decentpenguin]
<betawaffle> like filter/map/modify the generated decls
<andrewrk> betawaffle, related: https://github.com/ziglang/zig/issues/2070
<andrewrk> this is the other way around: you would "inject" more C code before importing, to perhaps expose macros or do other type annotations
ur5us has joined #zig
<betawaffle> the things i want to do are: rename things, exclude thing from being exported, and either replace some function argument types, or provide hints to avoid cases of [*c] types
FireFox317 has quit [Quit: Leaving]
<betawaffle> oh also... i want to be able to define methods and such on some of the generated structs/enums/etc
<andrewrk> this use case adds a lot of complexity that isn't strictly necessary
FireFox317 has joined #zig
<betawaffle> the latter thing would be completely unnecessary if we have newtype
<betawaffle> ok... what about this... what if @cImport was gotten rid of completely, and instead made available as part of the build system?
<betawaffle> in a way that we could write whatever we wanted to post-process the result before it gets turned into a zig file
<mikdusan> well the build system won't stop you from doing that right now
<andrewrk> it's already available as part of the build system
<andrewrk> b.addTranslateC
<betawaffle> hmm
waleee-cl has joined #zig
slowtyper has quit [Read error: Connection reset by peer]
meraymond2 has joined #zig
slowtyper has joined #zig
ifreund has quit [Quit: WeeChat 2.7]
<betawaffle> this seems like the issue i was after: https://github.com/ziglang/zig/issues/2457
<andrewrk> this proposal is to annotate the C source code
<andrewrk> e.g. if you have access to modify the upstream .h files
<betawaffle> well, it discusses some other things
<betawaffle> tbh, if @refiy was a thing, i wouldn't have a problem
<betawaffle> i also really want @result()
<betawaffle> (pointer to result location)
<andrewrk> the latter is #2765
jjido has joined #zig
<betawaffle> andrewrk: would it need to be a pointer, or does zig have the concept of it being a value in a particular location? ie. could you do @result() = foo, or would you need to do @result().* = foo?
<andrewrk> the latest proposal is that it would be a normal variable declaration and zig would infer that a certain variable is always returned at every exit point. if you relied semantically on this working, then you would get a compile error if it didn't happen with #3803 or #3804
<andrewrk> consider #2761 for why @result() is problematic
<Sahnvour> mikdusan: I am indeed building llvm myself, but I wouldnt understand how it affects compiling a stage1 .o file
dingenskirchen1 has joined #zig
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen1 has quit [Client Quit]
dingenskirchen has joined #zig
<FireFox317> ah andrewrk, i see you already merged #4435, nice!
<FireFox317> However, i think the test that you added currently won't pass, because how the code is currently structured it has to resolve all the decls before it knows the length.
<FireFox317> I'm currently working on trying to make each decl entry lazy, instead of the whole slice
<andrewrk> FireFox317, well it does pass
<andrewrk> :)
<FireFox317> hmm
<andrewrk> TheLemonMan, can we reach some kind of agreement on #3971?
<FireFox317> ah i see, in the test case you are looking at the fields of the struct, not the decls
<TheLemonMan> sure thing, I have no better idea tho
<andrewrk> FireFox317, yes and that test did not pass previously
<andrewrk> TheLemonMan, are you ok with my latest counter proposal? https://github.com/ziglang/zig/pull/3971#issuecomment-575766966
<FireFox317> andrewrk, nope indeed, okay cool :)
<andrewrk> TheLemonMan, I'm happy to take the PR if you want to hand-off. I just wanted you to speak your mind if you disagreed with it
<TheLemonMan> ehh, I think that's fine, I don't have {m,}any use-case for late-externing but we gotta start somewhere
zfoo_ has quit [Read error: Connection reset by peer]
<TheLemonMan> #4497 passed the CI checks o/
<FireFox317> nice work TheLemonMan!!
<andrewrk> TheLemonMan, another test for you to run locally: ./zig test ../test/stage1/behavior.zig --test-evented-io
<andrewrk> this passes in master branch on linux, but it's not covered by the CI
<TheLemonMan> you've killed my temporary happiness :(
<TheLemonMan> FireFox317, thank you for sparing me the pain of setting-up windows
<FireFox317> you're welcome :)
araspik has joined #zig
<andrewrk> TheLemonMan, sorry :( it can probably be fixed by putting `noasync` on some fn calls to prevent "asyncness" from bubbling up
<andrewrk> since it's guaranteed that we open the debug info in blocking mode
Akuli has quit [Quit: Leaving]
<TheLemonMan> oh I was running the tests with an old zig0 copy, let me retry
<andrewrk> anything that calls the stream write functions will become async without that
<andrewrk> TheLemonMan, btw the only thing `--test-evented-io` does is affect 1 line of std/special/test_runner.zig: https://github.com/ziglang/zig/blob/662996e4a8826f62f76bdafdb7ccbb1d52210c96/lib/std/special/test_runner.zig#L5
<araspik> How can I override `_start` while using `std` on Linux?
<TheLemonMan> pub fn _start() callconv(.C) noreturn { ... }
<andrewrk> araspik, note this will affect some language features such as threadlocal variables and ensuring the stack size is large enough, and some std lib features such as accessing environment variables and process parameters
frmdstryr has quit [Ping timeout: 272 seconds]
mahmudov has quit [Remote host closed the connection]
meraymond2 has quit [Remote host closed the connection]
kristoff_it has joined #zig
wilsonk has quit [Ping timeout: 268 seconds]
wilsonk has joined #zig
<araspik> andrewrk: that's all fine, I just wanted to see how small a program I could make. Thanks!
<andrewrk> araspik, here are some relevant flags: --release-small --strip --single-threaded
<araspik> andrewrk: It's not working, seems to expect a semicolon in place of `callconv(.C)`
<araspik> wait, it compiled with `pub fn _start() callconv(.C)` and no return type?!
FireFox317 has quit [Ping timeout: 260 seconds]
<araspik> ... never mind, `objdump` shows no assembly was left within, I used flags `--release-fast --single-threaded -ffunction-sections -fno-PIC -fno-stack-check --strip`
<andrewrk> all of these are redundant for your case: -ffunction-sections -fno-PIC -fno-stack-check
<andrewrk> you need to export _start
<andrewrk> pub export fn _start
<araspik> it's still giving me weird parsing errors
<TheLemonMan> ...are you using the 0.5 compiler?
<araspik> without `callconv(.C)`, it says that it expects `noreturn` on a line which already has `noreturn`
<araspik> with `callconv(.C) noreturn`, it expects a semicolon after `callconv(.C)`
<andrewrk> araspik, https://clbin.com/rIgr8
<andrewrk> you gotta refer to the 0.5.0 docs for the 0.5.0 compiler. but better yet, use a more recent compiler
<araspik> I'm on zig 0.5.0, should I build from source? (I'm on Gentoo, just did a full system upgrade)
<andrewrk> I recommend to use the binaries from ziglang.org/download unless you want to contribute to the compiler source code
<andrewrk> I thought the gentoo package had an option for master branch builds
<TheLemonMan> telling a gentoo user to use prebuilt binaries is a bold move
<andrewrk> haha
<andrewrk> well the build-from-source instructions are in the README, so... do what you want
<araspik> I'll setup a script to auto-download the binaries via the JSON page
mahmudov has joined #zig
<araspik> this solution is bordering on bearable ;)
<andrewrk> or just do it manually, and then update when you need a bug fix or new feature
FireFox317 has joined #zig
<andrewrk> it's just wget + tar xf
alexnask has quit [Ping timeout: 240 seconds]
<araspik> I've written a shell script to do it for me, and hooked up to cron
<araspik> now I'm happy
<araspik> I could probably set it up on master, but using prebuilt prevents me from needing to constantly update clang, which takes _forever_
<pixelherodev> `I thought the gentoo package had an option for master branch builds` it does
<pixelherodev> `emerge zig=9999` IIRC
<pixelherodev> No, wait
<araspik> pixelherodev: I don't remember how to set it up, and I'm too lazy/sleepy to do it right now
<araspik> It's probably something in `package.use`
<pixelherodev> Nah, I got it
<pixelherodev> `emerge -av =dev-lang/zig-9999`
<pixelherodev> Depending on your shell, might need to escape the =
<araspik> zsh, so probably
<pixelherodev> Yeah
<araspik> meh, I'll do it later
<pixelherodev> `sudo emerge -av \=dev-lang/zig-9999 --autounmask{,-continue}`
<pixelherodev> That automatically adds it to package.use and emerges it
<TheLemonMan> the command gets longer and longer heh
<araspik> TheLemonMan: Not if you use `EMERGE_DEFAULT_OPTS`
<araspik> But that shlt grows
<pixelherodev> That's not that bad
<pixelherodev> Keeping in mind that the equivalent on e.g. Debian would involve adding an unstable repository
<araspik> try writing out some highly specific update/resume command and you'll see what long looks like
<pixelherodev> Yeah, I had one that was ~10 lines recently
<pixelherodev> Because my package.mask was wrong :(
<araspik> I hate it when `emerge` sets up bad stuff automagically
<araspik> Once I had weird stuff going on in `package.use` that was forcing the introduction of a few use flags and stuff all because of this one package I'd installed (and then uninstalled) a while back
<pixelherodev> To be fair, it only happened because I was using LibreSSL
<araspik> the more exotic the setup, the longer the command
<pixelherodev> And not all ebuilds properly support it
<pixelherodev> Yeah
<araspik> the worst I've been in is trying to synchronize Ruby or Python versions across all packages
<pixelherodev> Heh, Python2's final EOL in Gentoo is going to be *fun*
<araspik> I cannot *wait*
<pixelherodev> Yeah sure
<pixelherodev> Though to be fair, anyone using Gentoo will probably know how to do that :P
<araspik> very true
<araspik> if you can keep a Gentoo system up-to-date for over a month then you have learnt almost everything you will ever need to know
<pixelherodev> Here's a fun idea: Suicide Linux + Gentoo :P
<araspik> `words[0].execute`
<araspik> or `words[4]`, depending on how you look at it
<pixelherodev> ?
<araspik> suicide, dude
<araspik> suicide
<araspik> also btw `emerge '=dev-lang/zig-9999'` is easier than optionally escaping based on shell
<araspik> I've updated the wiki accordingly
<pixelherodev> Right, thanks
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
araspik has quit [Remote host closed the connection]
slowtyper has quit [Ping timeout: 260 seconds]
slowtyper has joined #zig
<jaredmm> With a return type of *const [somefunc(input) :0] u16, is there a way to capture the function result in the body or do you have to run it twice?
frmdstryr has joined #zig
<andrewrk> jaredmm, you have to run it twice
<andrewrk> it's cached the second time
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
utzig has quit [Quit: leaving]
<ForLoveOfCats> Just to make sure my understanding is correct, async/await is completely seperate from threading yes? The whole concurrency vs parallelism jam
<jaredmm> Hm. That means this is three loops for W literals with a mostly duplicated function to calculate the codepoint length.
metaleap has quit [Quit: Leaving]
<andrewrk> ForLoveOfCats, the short answer is "yes". what OS are you currently on?
<ForLoveOfCats> Linux 4.19 x64
<ForLoveOfCats> How does async/await differ between supported platforms?
<ForLoveOfCats> I'm reading through https://github.com/andrewrk/zig-async-demo/tree/master/factorial and it makes the claim that async/await allows parallelism but my understanding of them is that they allow concurency via a coroutine-like (I know you don't like that word as it has different meanings to different people) style but without parallelism, what am I missing?
<andrewrk> ForLoveOfCats, it doesn't differ between platforms. here's a "hello world" async/await program: https://clbin.com/LRUS6 try running that with strace and see that it's not interacting with the OS at all
<andrewrk> I asked only before suggesting to use "strace" :)
<ForLoveOfCats> Ah, makes sense
<ForLoveOfCats> So what am I missing?
<ForLoveOfCats> I was under the impression that async/await allowd for concurency but not parallelism, but the above demo claims to demonstrate parallelism
<ForLoveOfCats> and by you're own statement here of it not interacting with the OS at all further implies that it is indeed not throwing up new threads to run in parallel
<ForLoveOfCats> *your
<andrewrk> this is the code that runs before main(). if you opt in to evented I/O mode then zig initializes a global std.Event.loop
<andrewrk> ...which spawns a thread pool
<ForLoveOfCats> Wait, so evented IO changes more than how IO is handled by the std internally?
<andrewrk> no, that's all it changes
kristoff_it has quit [Ping timeout: 272 seconds]
<ForLoveOfCats> But that's still not parallelism for the developer's written code
<andrewrk> basically, if you add `pub const io_mode = .evented;` next to your `pub fn main` then your zig application will have concurrency semantics very similar to Go
<andrewrk> I'm not following
<ForLoveOfCats> If that changes only how actual IO is handled, how does that allow general non-IO application logic to be written for parallelism?
<ForLoveOfCats> and I'm aware of std.Thread
<ForLoveOfCats> I'm trying to clear up my confusion with the wording of https://github.com/andrewrk/zig-async-demo/tree/master/factorial
slowtyper has quit [Ping timeout: 260 seconds]
<andrewrk> the default mode of the std lib event loop is a thread pool, with 1 worker thread per cpu core. so if you were to, for example, var f = async foo(); var b = async bar(); and then foo() and bar() do I/O, that will end up with threads executing in parallel
<andrewrk> you can also force it with std.Event.loop.startCpuBoundOperation()
<andrewrk> the beautiful thing about startCpuBoundOperation() is that it is a no-op in single threaded applications and blocking I/O applications
<ForLoveOfCats> So there *is* an toggleable global thread pool for non-IO application async/await?
FireFox317 has quit [Ping timeout: 260 seconds]
<andrewrk> I don't understand the question
FireFox317 has joined #zig
<andrewrk> the only global thread pool is in lib/std/event/loop.zig. you can grep the codebase to see what calls it. it's really not very complicated
<andrewrk> I'm sorry I'm not trying to be obtuse. I know the documentation for this is very poor
<ForLoveOfCats> I'm currently re-reading the documentation for this to better express my confusion (maybe even pick something out which fits together with something you've said here)
FireFox317 has quit [Client Quit]
<jaredmm> What would a Zig representation of a definition like `typedef struct tagMOUSEHOOKSTRUCTEX : tagMOUSEHOOKSTRUCT { DWORD mouseData; } MOUSEHOOKSTRUCTEX, *LPMOUSEHOOKSTRUCTEX, *PMOUSEHOOKSTRUCTEX;` be?
<andrewrk> jaredmm, you can find out by putting that in foo.c and then running: zig translate-c foo.c
<jaredmm> Yeah, it generates `pub const struct_tagMONITORINFOEXW = extern struct {
<jaredmm> szDevice: [32]WCHAR,
<jaredmm> };` which isn't valid.
<jaredmm> : struct_tagMONITORINFO,
<jaredmm> Silly newlines.
<andrewrk> I see. I don't actually know the answer to that question without investing a lot more time
<jaredmm> Ah
<daurnimator> jaredmm: what does the : do in C? I don't know if I've seen that before
<daurnimator> is that C++?
<jaredmm> It is.