ChanServ changed the topic of #zig to: zig programming language | | be excellent to each other | channel logs:
akhetopnu has quit [Quit: Lost terminal]
doublex has quit [Ping timeout: 245 seconds]
knebulae has quit [Read error: Connection reset by peer]
<andrewrk> daurnimator, that looks like you didn't give privileges to `make` to do the `install` step to the installation prefix
<andrewrk> release notes skeleton is done and many sections are complete. I still have the following sections to flesh out:
<andrewrk> it's going to be a long night for me
marijnfs has joined #zig
marijnfs__ has quit [Ping timeout: 240 seconds]
doublex has joined #zig
doublex has quit [Read error: Connection reset by peer]
doublex has joined #zig
doublex has quit [Read error: Connection reset by peer]
doublex_ has joined #zig
doublex_ has quit [Read error: Connection reset by peer]
doublex has joined #zig
doublex has quit [Read error: Connection reset by peer]
doublex_ has joined #zig
crimson_penguin has quit [Ping timeout: 264 seconds]
doublex_ has quit [Ping timeout: 240 seconds]
crimson_penguin has joined #zig
doublex has joined #zig
ltriant has quit [Ping timeout: 265 seconds]
ltriant has joined #zig
knebulae has joined #zig
mahmudov has quit [Remote host closed the connection]
doublex has quit [Ping timeout: 264 seconds]
_whitelogger has joined #zig
rsdimenus has quit [Ping timeout: 240 seconds]
dimenus has quit [Ping timeout: 240 seconds]
ltriant has quit [Ping timeout: 265 seconds]
ltriant has joined #zig
lukeholder has joined #zig
ltriant has quit [Ping timeout: 265 seconds]
ltriant has joined #zig
knebulae has quit [Read error: Connection reset by peer]
knebulae has joined #zig
chemist69 has quit [Ping timeout: 276 seconds]
chemist69 has joined #zig
rjtobin has quit [Quit: Leaving]
lukeholder has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
LargeEpsilon has joined #zig
marmotini_ has joined #zig
marmotini_ has quit [Ping timeout: 240 seconds]
marmotini_ has joined #zig
marmotini has joined #zig
marmotini_ has quit [Ping timeout: 265 seconds]
LargeEpsilon has quit [Ping timeout: 240 seconds]
LargeEpsilon has joined #zig
avoidr has quit [Quit: leaving]
LargeEpsilon_ has joined #zig
mmx870 has quit [Ping timeout: 245 seconds]
LargeEpsilon has quit [Ping timeout: 276 seconds]
mmx870 has joined #zig
lunamn has quit [Ping timeout: 276 seconds]
ltriant has quit [Quit: leaving]
marmotini has quit [Ping timeout: 240 seconds]
marmotini_ has joined #zig
_Vi has joined #zig
marmotini_ has quit [Ping timeout: 276 seconds]
<andrewrk> I'm going to bed. Still have the following sections to finish in the release notes:
<andrewrk> hopefully can finish those up in the morning and release early afternoon
marmotini_ has joined #zig
<andrewrk> release notes suggestions to the finished sections are welcome in the form of pull requests to (for the next ~8 hours)
<andrewrk> good night
marmotini has joined #zig
marmotini_ has quit [Ping timeout: 240 seconds]
marmotini_ has joined #zig
marmotini has quit [Ping timeout: 245 seconds]
konv has joined #zig
marmotini_ has quit [Ping timeout: 246 seconds]
tdc has joined #zig
marmotini_ has joined #zig
marmotini has joined #zig
marmotini_ has quit [Ping timeout: 240 seconds]
marmotini_ has joined #zig
<ceymard> is the grammar up to date in the documentation ?
marmotini_ has quit [Remote host closed the connection]
marmotini_ has joined #zig
marmotini has quit [Ping timeout: 264 seconds]
<ceymard> I see there is a "use" construct
<ceymard> but can find no documentation about it
<ceymard> does it still exist, or should it be removed from the language ?
<ceymard> also, it doesn't seem to mention async / await
<ceymard> oh wait it does, sorry
<mq32> ceymard, use is now usingnamespace
marmotini has joined #zig
<ceymard> oh ok
FireFox317 has joined #zig
marmotini_ has quit [Ping timeout: 265 seconds]
FireFox317 has quit [Remote host closed the connection]
marmotini_ has joined #zig
_Vi has quit [Ping timeout: 276 seconds]
marmotini has quit [Ping timeout: 268 seconds]
tines9 has quit [Ping timeout: 276 seconds]
marmotini has joined #zig
tines9 has joined #zig
marmotini_ has quit [Ping timeout: 268 seconds]
<Snektron> It release day
<presiden> nice
<daurnimator> andrewrk: that was just running `make` not `make install`
<ceymard> are varargs still a thing ?
<daurnimator> ceymard: yes.
<ceymard> the whole `: ...` thing
<ceymard> I saw sometime that it was going to be replaced
<daurnimator> ceymard: yep. its time has not come yet though
<ceymard> alright
kenaryn has joined #zig
<kenaryn> Hello people, is there something to help me build Zig from source please?
<kenaryn> I'm using Debian stable branch 10.1
<kenaryn> And I am looking for an explanation with regard to,-libclang,-and-liblld-from-source#posix if someone is available.
JinShil has quit [Quit: Leaving]
<ceymard> are promise part of async / await ? they're undocumented as of now ?
<mq32> ceymard, async values are promises
<mq32> var x = async foo();
<mq32> x is a promise that can be awaited with "var x_unpacked = await x"
<daurnimator> andrewrk: seems like ZIG_SKIP_INSTALL_LIB_FILES is required if `make` doesn't have write priveledges to the final location.... which is super odd. `make; sudo make install` is a pretty class flow...
<daurnimator> in any case, I'm now running the full test suite after just a `make`. now heading to bed.
<kenaryn> Please, doess llvm-9.0.0.src need to be located in '~/local' before running 'cmake' command with prefix=$HOME/local?
TheLemonMan has joined #zig
<TheLemonMan> kenaryn, grab llvm (and clang) from
<TheLemonMan> scientes, ping
rifkik has joined #zig
<kenaryn> Thanks TheLemonMan but now I have to add the unverified signature of the to a trusted vault. But gpg fails to add a new key. It tells 'no keyserver available' when I try to connect to My /etc/resolv.conf contains only 1 line: 'name', is that normal?
<TheLemonMan> did you do `wget -O - | apt-key add -` ?
<kenaryn> Nope, for several years I'm doing the following:
<kenaryn> gpg --keyserver --recv-keys <PUB_KEY>
<kenaryn> gpg -a --export <PUB_KEY> | apt-key add -
<kenaryn> For from now, it doesn't work anymore. I tried also to install Zig with snap but did'nt work and corrupted several apparmor profiles (which cannot be de-activated since the snap files doesn't exist anymore)
<kenaryn> Is that normal my /etc/network/interfaces contains only:
<kenaryn> auto lo
<kenaryn> iface lo inet loopback
<kenaryn> ?
<kenaryn> It is quite discouraging and painfully to install zig and begining to learn... :(
<mq32> kenaryn, why that?
<mq32> download a prebuilt tarbal, untar it and just rock everything ;)
<kenaryn> There is none in the wiki for POSIX systems.
<mq32> macos, freebsd, linux
<TheLemonMan> just use wget + apt-key, it's not that hard
<TheLemonMan> configuring gpg is a completely different tarpit/topic
<kenaryn> I tried, but it returns 'Cannot write to ‘-’ (Broken pipe).'
<kenaryn> Did you accidently add a non-required dash '-'?
<TheLemonMan> you have to be root in order to use apt-key
<kenaryn> switching to root.
<kenaryn> returned OK, trying the next step.
<kenaryn> in fact, I do not know the next step. It's really weird to be finally able to use Zig.
<kenaryn> Do I have to type this: wget
<kenaryn> chmod +x
<kenaryn> sudo ./ <version number>
<kenaryn> ?
<TheLemonMan> I guess that `apt install llvm-9-dev libclang9-dev` is enough
<kenaryn> Thank you for your patience but it returns E: Unable to locate package libclang9-dev
<kenaryn> The total absence of documentation is a deal-breaker for Zig adoption.
<mq32> kenaryn, why do you want to build zig from source?
<kenaryn> There will always be off-topic and pain-in-the-ass like my while there will be none user-friendly doc
<kenaryn> mq32 I am just trying to install Zig to create softwares in Zig, for several days.
<mq32> yeah, so still my question: why not use the provided pre-built tarball?
<kenaryn> At this point I do not care how to achieve it, I just want to accomplish it.
<mq32> what OS are you on? linux? windows? macos? freebsd?
<kenaryn> Debian stable 10.1
<mq32> so just download the linux prebuilt binary?
<mq32> link is above
<kenaryn> Yes, thank you, it is now downloaded.
<mq32> this tarball provides everything you need. no need for setup,install,nothing
<mq32> just unpack and have fun ;)
<kenaryn> Do I have to make it executable whith chmod +x before unpacking it?
<mq32> nope, the contents of the tarball should be alright already
<kenaryn> It is now unpacked.
<kenaryn> But now a situation remains, how to use it? there is still no doc about it...
<mq32> just run the zig executable
<mq32> it is self-documenting
<kenaryn> The terminal still tells me 'zig: Command not found.'
<mq32> if you want to have the zig executable globally available, you have to add it to your PATH variable
<mq32> (like with every program manually installed)
<kenaryn> It is amazing the amount of expertise required to use it even in a allegedly simply way.
<mq32> kenaryn: this is basic linux expertise, nothing to do with zig
<TheLemonMan> oh come on, you're having problems with linux
<kenaryn> I do not see .exe extension so I suppose it is zig (137 MiB shared library)?
<mq32> kenaryn, linux executables don't have .exe extensions
<kenaryn> Allright
<mq32> they usually have no extension at all
<mq32> if you "ls" your zig directory, it should similar to this:
<mq32> [felix@denkplatte zig]$ ls
<mq32> lib LICENSE langref.html zig
<kenaryn> yes i see zig with a star (i.d. zig*)
<kenaryn> can I rename zig-linux-x86_64-0.4.0+543e7293 into zig without breaking anything?
<mq32> yes
<kenaryn> Thank you.
<mq32> if you want to know more about PATH, read here:
<kenaryn> I tried zig/zig but it returns ^?ELF^B^A^A^C: Command not found.
<kenaryn> Too many )'s.
<mq32> huh
<mq32> you're doing something weird
<kenaryn> sorry I tried tcsh zig/zig
<kenaryn> i just abandonned bash a week ago.
waleee-cl has joined #zig
<ceymard> kenaryn: how about ./zig ?
<ceymard> while being in the same directory
<kenaryn> lol you were right, but now I have to export the new path variable but I do not know in which file, since tcsh do not call .bashrc to make the change permanent
<mq32> kenaryn: look here:
<mq32> how to install zig
<mq32> then look up the docs for tcsh ;)
<kenaryn> thanks a lot for your kindness
<ceymard> the grammar shows that a statement like `const myvar = contine` is valid, is it normal ?
<ceymard> continue*
<mq32> yes
<mq32> continue is an expression
<kenaryn> the terminal returns Bad : modifier in $ '/'. when I type export PATH=$PATH:/home/aurele/local/zig
<kenaryn> Do you know why?
<kenaryn> export PATH=$PATH:`pwd` returned the same error.
<mq32> because you don't use bash, but tcsh
<mq32> use the correct syntax for tcsh, then it will work
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
_Vi has joined #zig
<kenaryn> Allright, thank you for your patience.
marmotini has quit [Ping timeout: 240 seconds]
marmotini_ has joined #zig
kenaryn has left #zig ["WeeChat 2.3"]
kenaryn has joined #zig
<kenaryn> Allright, just to say my first hello world program finally worked, so thank you kindly ceymard, mq32 and TheLemonMan
<ceymard> mq32: is it the noreturn type ?
<ceymard> oh it is
lunamn has joined #zig
doublex has quit [Ping timeout: 245 seconds]
doublex has joined #zig
<ceymard> what's the difference between a for statement and a for expression ?
<mq32> good question
<mq32> i think a for expression must be breaked and have an else branch
<mq32> var x = loop: for() { … break :loop 10 } else { 20 };
<ceymard> is there a reason there is a difference between then in the grammar ?
kidosatori has left #zig ["WeeChat 2.5"]
<mq32> dunno, you can write for() { } as a statement
<mq32> and don't require breaking and "else"
<mq32> but i don't know the grammar for this point
<ceymard> ok
<rifkik> Who's ready for 0.5.0?
<fengb> Probably not andrewrk 😘
<fengb> 🙃
<fengb> Wrong smiley. That looks so creepy
<ceymard> I thought it was perfect
<andrewrk> daurnimator, your questions are answered in
<andrewrk> I have a cup of tea and 6 hours of sleep. let's do this
<rifkik> Andrew is on l33t Hacker Mode
kenaryn has left #zig ["(The show must go on.)"]
<LargeEpsilon_> Hi, I have a small question regarding zig lang. Is it possible to use OpenMP with zig ? and if not for the moment is it planed to be supported one day ? Thanks in advance
halosghost has joined #zig
<Cadey> LargeEpsilon_: what do you think that means?
<Cadey> just so we're on the same page
porky11 has joined #zig
<LargeEpsilon_> It would be the equivalent of #pragma omp X
<LargeEpsilon_> for parallelization and SIMD
<LargeEpsilon_> as supported by clang for C/C++/Fortran
dimenus has joined #zig
<fengb> `try await try async fs.openReadWrite` that was so clunky :P
<andrewrk> scientes, can you link me to your llvm talk?
<andrewrk> fengb, yeah now it's try fs.openReadWrite
<scientes> I still need to review the slides
<andrewrk> yeah I was just going to link to it in the release notes if that's ok
<scientes> yeah fine
<fengb> I'm pre-gaming with old release notes >_>
<andrewrk> I'm about to make the tag
<scientes> i'm working on updating the glibc symbols and this line doesn't work
<scientes> ./update_glibc ~/multi/install/glibcs ../lib
<andrewrk> then I still need the hour it takes to pass CI to write up the Async Functions section. Haven't started that section yet :(
<scientes> rather ./update_glibc ~/downloads/glibc ../lib
<scientes> not sure where ~/downloads should be fixed to
<andrewrk> I don't have the energy to do a really good async functions section in the release notes today. that's going to have to be a separate post or something
<scientes> heh, the glibc build is like 15 hours
<andrewrk> scientes, the first arg to ./update_glibc is the source tree of glibc
<scientes> oh i got it
<andrewrk> it's looking for those abi list files
<scientes> ~/multi/src/glibc
<ceymard> is it possible to create new functions during compile time ?
return0e has quit []
<scientes> ceymard, not yet
<scientes> well, you are asking about a JIT, that is different from anonymous functions
<scientes> is "32" in abi.txt glibc 2.22?
<ceymard> scientes: so it is planned ?
<scientes> ceymard, i'm not sure if you are talking about anonymous functions or a JIT
owl_000 has joined #zig
<ceymard> neither
<ceymard> I want to know if I can generate a function during comptime
<scientes> I think anonymous functions would be able to do that
<ceymard> just like inline for inlines a loop
<scientes> like a template
<ceymard> yup
<ceymard> exactly like that
<owl_000> is there function overloading or something like that
<owl_000> in zig
<scientes> owl_000, no, shadowing is explicitely disallowed
<scientes> of course, if you use dynamic linking than that type of stuff still exists
<owl_000> what is the procedure to pass float and int
<fengb> If it’s template like behavior, you can do a lot of that with comptime args
<scientes> owl_000, you can pass any type to "var", but you can't return arbitrary types yet, and that is controversial
<owl_000> ok, i am actually trying out zig. but i like the idea of lean and clean c replacement.
<dimenus> 0.5 is almost here!
tencho has joined #zig
<owl_000> `warn("{} {}",1,2);` #557 still exists
<owl_000> why?
<fengb> Because the workaround is probably easier than the fix
<tencho> Is it bad to return a slice of a local array? like this
<fengb> tencho: yes that's undefined behavior and mostly referencing garbage memory
<fengb> most likely*
<euantor> Guess I better prepare to update the chocolatey package - last time I was a day late and managed to get a comment asking where it was even with that short delay 😆
<andrewrk> euantor, you still have ~40 minutes until the CI finishes :D
<andrewrk> which is good, I'm still writing the release notes @_@
<euantor> I'll get a PR open ready for it, then I just have to wait for the chocolatey reviewers
<konv> andrewrk, is there any way I can help you with that?
<andrewrk> konv, not anymore, it's almost done
<andrewrk> you can help me in 6 months by reminding me to leave more than 1 week for writing release notes
<andrewrk> ya'll were too damn productive this cycle
<owl_000> 351 issues were closed before this release. lot of work. great job
<ceymard> why not having a changelog somewhere ?
<ceymard> it would allow people to check on zig's development more often than every 6 months
<andrewrk> ceymard, here it is:
doublex has quit [Ping timeout: 252 seconds]
<ceymard> andrewrk: I meant something a little more curated :D
<ceymard> but I get how it could be a hassle given the sheer amount of commits...
<andrewrk> I'm happy with the division of time I've chosen on docs vs progress
doublex has joined #zig
owl_000 has quit [Ping timeout: 245 seconds]
earnestly has joined #zig
<andrewrk> the fact that it's been 6 months since 0.4.0 will give us a nice media day today
<companion_cube> is the release happening right now?
hasanyasin has joined #zig
<andrewrk> CI is building the 0.5.0 tag. I'm wrapping up release notes, will have them uploaded soon
<hasanyasin> Congratulations for 0.5!!!
<hasanyasin> Newbie Question: Is there a native way to map strings to enum values directly? When I print an enum value, it prints the name instead of integer value, so I guess enum names are available as strings to the compiler already. If this could work vice versa as well, that would be awesome.
<fengb> 🎉
<scientes> where does it strip -lc and -lm ?
<scientes> when linking against the glibc stubs
<scientes> anyways, that is kinda minor
<hasanyasin> Typical use cases may be for example mapping headers/messages on text-based network protocols or command line arguments.
shritesh has joined #zig
<andrewrk> hasanyasin, @enumToInt / @intToEnum
<hasanyasin> I mean something like @labelToEnum? :D
doublex has quit [Ping timeout: 240 seconds]
<andrewrk> oh, check std.meta
<hasanyasin> Thank you!
doublex has joined #zig
LargeEpsilon_ has quit [Ping timeout: 276 seconds]
<hasanyasin> This is so cool! With Go, to use enum labels like this (const names in Go), I would use code generation, so kinda two-phase compilation.
<hasanyasin> With zig, just a single line:
<hasanyasin> return std.meta.stringToEnum(Cmd, str) orelse CliError.CommandNotFound;
<hasanyasin> This is so beautiful.
fsateler has quit [Ping timeout: 265 seconds]
<hasanyasin> andrewrk: Do you think it would fit the language style/design and your taste to have this function in std as a builtin such as @labelToEnum or maybe even T.fromLabel where T is any enum type?
fsateler has joined #zig
doublex_ has joined #zig
doublex has quit [Read error: Connection reset by peer]
<shritesh> 0.5.0 tests have passed!!!
<konv> \o/
tencho has quit [Remote host closed the connection]
<andrewrk> release notes done, uploading now
<halosghost> :D
<tgschultz> hasanyasin: std.meta was started with the opposite intention, to move builtins to userland code where possible. I'm not sure if that is still the direction we're headed or not though.
<hasanyasin> I see!
<hasanyasin> Maybe two separate directions make more sense based on the functionality. HashMap fits standard library perfectly when we have enums and enum labels can be used as strings with the mentioned function in std.meta.
<hasanyasin> Of course, I am probably coming from a very different background than most Zig users so I may not be making any sense. Sorry if that is the case.
<Tetralux> I'm not sure why you wouldn't just use a map with enum keys in that case
<Tetralux> Or even just an array, depending.
LargeEpsilon has joined #zig
<hasanyasin> All the keys are known at compile time so enum makes perfect sense. I am already very happy with what we have now. What I was trying to suggest is that if this is a very common case, maybe it would make sense to have this function as a builtin as well.
<hasanyasin> Let's say you are writing an http server. In almost every modern HTTP server library that I used, method was defined as string which never made sense to me.
<hasanyasin> In Go, you check request method as req.Method and it has type "string"
<hasanyasin> There might be of course optimizations in compilation, but using integers for HTTP methods seems much more correct to me.
<fengb> It's because the method can be arbitrary... eventually
<hasanyasin> And with zig enums and std.meta.strToEnum, it is crazy easy and fun to do! :D
<fengb> Spec is open to extending at any point
<hasanyasin> fengb, do you mean HTTP spec?
<Tetralux> You could have an enum with values .Get and .Post and then strToEnum and toUppercase (though, I don't think we have the second one in the stdlib.) :)
<Tetralux> Or rather enumToString, or whatever it's called.
<Tetralux> .. You know what I mean Xd
<fengb> Yeah, IIRC PATCH was shoehorned in
<hasanyasin> Yes, we already have this use case perfectly addressed in Zig. Compile time work is awesome.
<Tetralux> +1
<Tetralux> The more you can do at comptime, the better.
<tgschultz> PseudoStructs can act as a sort of comptime-know-string 0-runtime-cost hashmap, but there's probably a simpler solution.
<hasanyasin> fengb, I just tried to give an example with HTTP. When you are implementing a library for any protocol, it doesn't make sense to have your code cover future cases before those cases exist. :D If HTTP 3 brings in new protocols, your library will not know those protocols so it will be an error case for your version until you add the new methods to the enum type you designed.
<Tetralux> tgschultz: I'm probably not gonna do it if it's not running the same code as at runtime.
<scientes> just use HTTP/1.1 for now
<fengb> I suppose that's true. I'm giving an excuse for existing implementations :P
<scientes> that is WAY easier, and still works everywhere
<hasanyasin> :D :D :D
<fengb> Since technically the data is a string, keeping it as a string sorta makes sense
<scientes> zig doesn't have strings
<hasanyasin> scientes, that was just an example. What I was trying to say has nothing to do with HTTP actually.
plumm has joined #zig
<plumm> just came to say congratulations :)
<rifkik> Congrats!
<hasanyasin> Yeah, very happy to see 0.5. I have already updated my local binary.
<scientes> oh cool, it is here!
* halosghost patiently awaits the release notes
<Tetralux> It's kinda weird to do `zig version` and have it just say `0.5.0`
<Tetralux> :D
<tgschultz> I'll have to schedule some time to update all my public code. Also to wrap my head around the new coroutines to see if replacing my state machine implementations with them would be cleaner.
<andrewrk> download page is live
<hasanyasin> I don't know if you watched the videos of last few live sessions, but I believe those are very good to understand async/await.
<Tetralux> tgschultz: While you're at it, I'm interested how much performance changes. I'd imagine you are too :)
<mikdusan> 1541 commits 👍
<hasanyasin> Congratulations @andrewrk!
<konv> Congrats!
FireFox317 has joined #zig
<FireFox317> Congrats Andrew!!
<andrewrk> great work everyone, typing up these release notes made me realize just how much the community has pitched in
<andrewrk> if anyone is mentioned in the notes and wants things to be reworded, shoot me a pull request
doublex_ has quit [Ping timeout: 268 seconds]
<mq32> <mikdusan> 1541 commits 👍
<mq32> sounds like i have to fire up my floppy drive again…
<mq32> congrats on the release!
<euantor> Chocolatey package published, awaiting moderation:
<scientes> andrewrk, the C ABI is also not fully implemented for arm64
<andrewrk> scientes, I'll make note of that
<fengb> needs to be updated
<halosghost> fengb: oh?
<halosghost> fengb: that page looks good to me?
<fengb> nvm
<halosghost> :)
<fengb> I'm blind. I just assumed the first bulletpoint is master
hasanyasin has quit [Remote host closed the connection]
kristoff_it has joined #zig
<halosghost> it's true that master is not on that list
<halosghost> so, if it should be, then yes, that should be changed
<andrewrk> halosghost, master == 0.5.0 currently. it'll get overwritten from the template next time the CI server finishes
<halosghost> andrewrk: makes sense
<kristoff_it> congrats to andrew and everyone that contributed for the new release!!
<halosghost> indeed
wootehfoot has joined #zig
FireFox317 has quit [Ping timeout: 260 seconds]
<plumm> is there any current time library btws?
<shritesh> Submitted 0.5.0 to homebrew
<plumm> people on the discord also send their congratulations
<andrewrk> <3 shritesh & euantor
<Cadey> yay 0.5.0 :D
<Cadey> andrewrk: congrats on the release!
Barabas has joined #zig
<andrewrk> thanks everybody :)
<Tetralux> andrewrk: Is {1:5.9} meant to be {0:5.9} in `Formatted Printing`?
<Barabas> Hello
<Tetralux> Barabas: o/
<Barabas> I tried some zig a while ago, but it seems the syntax has changed a bit
<Barabas> How do I initialize a slice (member) to an empty slice?
<andrewrk> Tetralux, good catch
<Tetralux> `field: []T = [_]T{}` IIRC.
<Barabas> Ah
<Barabas> I could have thought of that myself :P
<Tetralux> You can populate it to all zeroes, for instance, with `[_]T{0} ** count` also :)
<Tetralux> andrewrk: ;)
<Tetralux> Am I to guess that big.Rational cannot represent an arbitrary precision fractional value?
<donpdonp> new Zig lang today. long live zig!
<Barabas> oh wow, so I actually missed two whole version :o
<andrewrk> I'm hoping to see the release notes on HN and reddit today
<shritesh> I may have just submitted it to HN ;)
<donpdonp> shows it, and upvoted.
FireFox317 has joined #zig
<tgschultz> segfault stack traces, nice.
_Vi has quit [Ping timeout: 276 seconds]
<donpdonp> okay now i can sit down and read the thing. the number of systems mentioned with some kind of support is amazing.
<andrewrk> with test coverage now too
<donpdonp> and.. front page of hackernews. (currently #13 for me)
<plumm> yep, 13
<plumm> lol @ the 69 & 420, doubt any other language would let that slide hehe
* halosghost posts the release notes on lobsters
<halosghost> oh, it already got posted
<halosghost> nevermind
* halosghost upvotes
Akuli has joined #zig
rifkik has quit [Remote host closed the connection]
<donpdonp> #2 spot on both hackernews and lobsters. word travels fast.
<andrewrk> oh crap I forgot to search for TODO in the release notes
<plumm> lmao i was gonna point it out but assumed you left it there for a reason
<Tetralux> There's 10 of those :)
<Barabas> This also looks weird all the functions are in there twice?
<andrewrk> TODO make code example of this -> NOPE! TODO: pull code example -> Nope!
<andrewrk> Barabas, so you can see the fn signature
<andrewrk> oh, I see
<andrewrk> so many mistakes
<Tetralux> I know the feeling
<FireFox317> andrewrk, you're gonna put it on r/programming yourself?
<andrewrk> no
<Tetralux> Every time I write anything, I always check multiple times for errors, and then still have to spend 15 minutes fixing mistakes after I posted it xD
<andrewrk> I'll upvote it really hard though
<andrewrk> I usually do that but I ran out of time
shritesh has left #zig [#zig]
<Sahnvour> congrats everyone on the release
<andrewrk> you too Sahnvour
<FireFox317> Posted!
<Sahnvour> thanks ! now let's enjoy these release notes :)
* donpdonp sees andrewrk's toot about 0.5.0 inside zootdeck that was built with 0.5.0. #winning
shritesh has joined #zig
<Barabas> > Async functions are no longer generic, and do not require the async keyword. Zig infers that a function is async when it observes that the function contains a suspension point.
<Barabas> Doesn't this make it hard to see whether a function is async or not?
<Barabas> Especially when it's only async because calls another function which has a suspension point.
<andrewrk> yes, similarly to how it's hard to see whether a function can execute at comptime or not
<donpdonp> for those new to mastodon and want to follow that account.
<Cadey> andrewrk: what would an event loop for something that spawns multiple indepdendent HTTP downloads look like?
doublex has joined #zig
<andrewrk> :-)
<Tetralux> Did std.event.Loop get fixed for the new async?
<Cadey> oh
<Cadey> because stack frames are variables
<shritesh> I love that the theme of 0.6 is going to be safety.
<Cadey> oh shit
<andrewrk> it's still correct for the new async. there are bugs though, it needs to be audited & fuzz tested
<Tetralux> andrewrk: Gotcha.
<andrewrk> Cadey, you might enjoy the most recent stream I did, some fun async demos
<Barabas> Oh I see. Async functions can also be non-async, somehow. Kinda cool, also kinda confusing.
<andrewrk> yeah that one. also this older one (the bugs don't apply anymore) shows off resuming an async function in a different thread
<andrewrk> I plan to make these demos in text form eventually
<andrewrk> but right now I'm going to go have lunch
<Tetralux> Barabas: `noasync async_function()` just asserts that the otherwise-async function does not actually suspend on that particular call.
<Cadey> andrewrk: i really like that you managed to do async without hard depping an allocator
<plumm> my main confusion is that global frame var, whats the point of that?
<Cadey> that's just nuts to me at some level
<shritesh> Cadey: Async functions also work across WASM boundary
<Cadey> shritesh: ?
LargeEpsilon has quit [Ping timeout: 240 seconds]
<Tetralux> plumn: The global frame is because when the function suspends, you have to "have a plan" for resuming it. In that example, you aren't using an event loop (which is normally how you'd do it), so instead, when it suspends it filled out the global with it's own frame, which is used to resume it later.
<shritesh> You can suspend from zig and resume from wasm (vice versa too I guess).
<Cadey> hahahahaha
<Cadey> i love that
<Tetralux> Normally, you wouldn't call resume or suspend manually; you'd use async/await instead.
<FireFox317> That is so cool tho
<Tetralux> > You can suspend [...]
<Tetralux> Wait
<donpdonp> andrewrk: unrequested advice incoming, I hope you take more than lunch off and rest up a bit. seems to be you're doing an incredible amount of work and management and burnout is real.
<Tetralux> How
<Cadey> i'm gonna compile that to webassembly and read the compiler output
<plumm> Tetralux: is there not already an event loop?
<Tetralux> plumn: Only if you make one and call .run on it, IIUC.
<Cadey> plumm: the stdlib has one yeah
<shritesh> If you're using WASM in a JS-host environment, it makes sense to use the JS event loop itself.
<Tetralux> I'm not clear what std.event.Loop.instance [or whatever it's called] is about, though.
<Tetralux> Does that get populated when you make an event loop? I'm guessing not.
LargeEpsilon has joined #zig
<Tetralux> andrewrk: Also, the first example in 'Async Functions' -- does that not produce a compile error; the one about _start cannot be async?
<andrewrk> thanks donpdonp
<andrewrk> Tetralux, it's not doing `func()`, it's doing `async func()`. async fn call is not a suspend point; await is
<Tetralux> Ah.
<Tetralux> I guess I got a little confused because normally your examples have asyncMain() xD
return0e has joined #zig
<Cadey> andrewrk: why doesn't zig use the start section?
<andrewrk> Cadey, I don't remember but I remember there is a good reason for this
<Cadey> oh is it LLVM dumbness?
<Cadey> i remember reading something about LLVM being really dumb wrt the start section
<shritesh> The runtime will not have any initialized memory
<Cadey> oh
<Cadey> ugh
<Cadey> that's dumb
<scientes> daurnimator, does worksforarm have M-profile processors so i can test helium SIMD instructions?
<andrewrk> I don't mind negative comments at all, but false claims with no evidence drive me insane
<plumm> whos hurting you
<andrewrk> it's just annoying to do the chore of responding so that drive by viewers don't get incorrect facts
<fengb> Is this the guy who claims "Zig is too complicated"?
<andrewrk> yeah haha
<FireFox317> Jup those people will always be there
<Cadey> haters gonna hate
<Cadey> ponies gonna pwn
<Cadey> etc
<tgschultz> what happens if I `await` a function with `suspend` in it, having not called `resume` anywhere?
<Cadey> shritesh: this is actually pretty interesting
<Cadey> i like how simple it is
<Cadey> you can see the suspend point getting inlined into the amain function
<Cadey> er
<Cadey> you can see it do the thing
<Cadey> i words good not
<andrewrk> tgschultz, then your `await` suspends indefinitely
<shritesh> Yeah, `call_indirect` is where the magic happens.
<andrewrk> tgschultz, it's a lot like not calling free(). it makes sense to not do sometimes, like with arena allocators
<tgschultz> yeah, I'm just trying to figure out how I'd alter state machines that currently exist to use async instead, and if that would actually be less complicated or not. For my bmp lib, so far it seems like it wouldn't have any benefit in terms of cleaning things up. that isn't a criticism, it isn't really designed to replace arbitrary state machines.
<fengb> tgschultz: I've cobbled together a paradigm for generators. That could possibly work for state machines
waleee-cl has quit [Quit: Connection closed for inactivity]
hasanyasin has joined #zig
LargeEpsilon has quit [Ping timeout: 245 seconds]
hasanyasin has quit [Ping timeout: 240 seconds]
shritesh has quit [Remote host closed the connection]
kristoff_it has quit [Remote host closed the connection]
kristoff_it has joined #zig
plumm has quit [Quit: Lost terminal]
mahmudov has joined #zig
kristoff_it has quit [Ping timeout: 268 seconds]
_Vi has joined #zig
konv has quit [Ping timeout: 268 seconds]
<Tetralux> Wait - in the #2046, a backslash with a newline immediately after it isn't enough to disambiguate it?
<Cadey> andrewrk: thank you for making async work without function colors
<fengb> The most amazing thing is that blocking IO just works. I really didn’t expect that
<mikdusan> Tetralux: .d escapes are shockingly bad; and also a prime example of technical debt
<Cadey> oh damn
<Cadey> this means i can make my templeos code ported to zig example about 500x more efficient
<Barabas> Somehow while(pointer) and expecting it to stop when pointer becomes null doesn't work anymore?
<Tetralux> That smells of result location.
<Barabas> There's not even a result =L
<Tetralux> I forget exactly how this was fixed in std.
<Tetralux> When implementing result location semantics, a similar piece of code was a problem that was worked around.
<Tetralux> andrewrk, ping.
<Tetralux> Try getting rid of the temporary 'node'.
<fengb> Barabas: what's the error?
<Barabas> while (self.head) |n| { self.head =; self.allocator.destroy(n);}
<Barabas> this also doesn't work
<fengb> What's the error?
<Barabas> fengb 'cast causes pointer to be null'
<Tetralux> Oh interesting.
<Tetralux> Nevermind.
<Tetralux> The problem I was talking about was not a compile error.
<Tetralux> Might be related to a recent issue.
<Barabas> it's at runtime
<Barabas> 2/10 test "SingleLinkedList prepend"...cast causes pointer to be nullC:\Users\Bas\lib\zig\std\mem.zig:91:31: 0x7ff63edc39b6 in std.mem.Allocator::std.mem.Allocator.destroy (test.obj)C:\Projects\ZigZag\containers\single_linked_list.zig:41:39: 0x7ff63edc2bb8 in SingleLinkedList(u32)::SingleLinkedList(u32).deinit
<Barabas> (test.obj)C:\Projects\ZigZag\containers\single_linked_list.zig:136:27: 0x7ff63edc1c54 in test "SingleLinkedList prepend" (test.obj)C:\Users\Bas\lib\zig\std\special\test_runner.zig:13:25: 0x7ff63ede360e in std.special.main (test.obj)C:\Users\Bas\lib\zig\std\special\start.zig:113:49: 0x7ff63ede33df in ??? (test.obj)
<Barabas> oh, that's unreadable
<Barabas> Tetralux interesting, looks similar to the error I get.
<Barabas> Though that means I've run into two bugs =P
<Tetralux> Consider yourself privileged :p
<fengb> Hmm, logging gives me Node@1071d2038, Node@0
<Barabas> The error points to the destroy function in the std lib
<Barabas> const non_const_ptr = @intToPtr([*]u8, @ptrToInt(ptr));
<fengb> That's not right
<Barabas> with that line
<fengb> Yeah it's iterating the null
<Barabas> Yes =|
<fengb> Hmm, I stuck an if statement there and that works as expected
<Tetralux> You mean like, `if (node == null) break` ?
<fengb> Was doing if(node) |nn| self.allocator.destroy(n)
<fengb> The break also doesn't work...
avoidr has joined #zig
<Tetralux> So it's acting like `n` in still a nullable type, but destroy doesn't take a nullable and therefore it errors?
<fengb> Oh
<fengb> Yeah it's result location
<fengb> `while (node) |n| {`
<fengb> This makes "n" a window into the variable
<fengb> So when you reassign node, you also reassign "n"
kristoff_it has joined #zig
<Barabas> cool
<fengb> Try `const n_copy = n`
<fengb> That explicitly copies the value out
<Tetralux> Does `while (node) |n| : (node = {}` work?
<Tetralux> [[ I forget exactly where the ':' goes there. ]]
<fengb> Oh yeah that should work too
<Barabas> the const thing works
<Barabas> And that other thing as well
<Barabas> Thanks for looking into it :)
<fengb> Use the other thing. it's more idiomatic
<Tetralux> Basically - the error should be "cannot modify content of 'n' because it is unwrapped; you can copy it with an explicit assignment and use that instead or possibly use the after-loop statement."
<Barabas> So that just calls destroy before re-assigning node, right?
<Tetralux> Or rather - "because the unwrapped optional value is const" - sometihng like that.
<Tetralux> Barabas: And yes.
<Tetralux> Runs the loop block; runs the statement after ':'
<Barabas> hmhm
<Tetralux> Just like in:
kristoff_it has quit [Ping timeout: 240 seconds]
<Tetralux> .. `while (i < n) : (i += 1) {}`
<Barabas> There's some other test which fails now, so I'm betting that's due to a similar construct
<Tetralux> Probably xD
ky0ko has joined #zig
<fengb> Yeah, it'll return the address of the current self.node.value
<Barabas> Yeah =|
<Barabas> I kinda feel like it shouldn't be like this.
<Barabas> (I'll fix it with defer?)
<Tetralux> That sounds like something that should be a compile error.
<FireFox317> Such a pity you weren't in here before the release
<fengb> This is a known footgun :/
<Barabas> I almost was! I just got sick the day before yesterday.
<Barabas> Otherwise I'd have done it yesterday ^^
<Barabas> xD
<Tetralux> Barabas: I'd suggest either `if (...) |_| {` or `if (self.node != null)1
<Tetralux> But if defer is cleaner ... :)
marmotini_ has quit [Ping timeout: 265 seconds]
<Barabas> I'm not sure what you're suggesting.
<Tetralux> Basically, avoid using node at all.
<Barabas> I can manually do the unwrapping, yes.
<FireFox317> I think you would want to hear andrew's option about this use case
<Barabas> I'll open an issue
mahmudov has quit [Read error: No route to host]
mahmudov has joined #zig
Akuli has quit [Quit: Leaving]
<_Vi> How idiomatic is omitting braces after `if()` or `while()` in Zig?
<halosghost> is it even legal to omit braces?
<Barabas> FireFox317 Tetralux in case you're interested.
<Barabas> halosghost apparently it is... :/
<Barabas> at least it compiles
<halosghost> mm
<halosghost> that's a bummer
<Barabas> Agreed =D
<Barabas> wow, the singly linked list in std is weird.
<Barabas> it takes an allocator per node
<Tetralux> Wait - it does?
<Tetralux> Oh right - I gotcha.
<Barabas> I don't know what the use case there is though. If you ever allocate different nodes with different allocators, you've to keep track of which node used which allocator somehow =/
<mikdusan> Barabas: afaik all unwrapped optionals/unions/etc are aliases since result-location branch was merged. and this is how it's supposed to work
<Barabas> hm... well it's confusing.
<mikdusan> well it saves a forced copy
<Barabas> sure...
<mikdusan> i think if there was syntax like this it would help: `if (wrapped) |var unwrapped|` or something similar... that would handle your usecases and clarity, right?
<Barabas> You can already do `if (wrapped) |*unwrapped|`
<Tetralux> .. where 'var' generally means 'make storahe for this here'
<Barabas> Which handles the 'I don't want a copy' usecase.
<mikdusan> that's not the same thing; `*` means mutability
<Barabas> hmm
<Tetralux> well no
<Tetralux> * means 'pointer to'
<Tetralux> but yes
<fengb> mikdusan: his case was that he mutated the original location, and it affected the unwrapped value
<fengb> The code doesn't make it look obvious what's going on
<fengb> It's sort of akin to how Go functions close around for loop variables. Sure we can learn it, but it still feels wrong
<Tetralux> ?
<mikdusan> if the rule is "unwrapping makes alias" then it is obvious
<Tetralux> Oh . Huh. Ugh.
<andrewrk> I don't consider this to be "stable" part of the language yet, it's still under consideration what the best semantics are here
<Barabas> Well, you can make arguments for both ways. So it's not obviously wrong. Just a bit confusing imho.
<knebulae> @andrewrk: congrats on 0.5.0!
<andrewrk> thanks knebulae :)
<Barabas> Yes, overal the progress looks very good :)
<FireFox317> damn, so many new issues already after the release xd
avoidr has quit [Quit: leaving]
dimenus has quit [Read error: Connection reset by peer]
<_Vi> How do I do a block N times in Zig without introducing a new variable for a counter?
<mq32> _Vi, somebody beat me, but
<_Vi> Is there some trick like `for([1]void{} ** N) |_| { .... }`? Preferrably for non-const N.
<mq32> for([_]{0} ** N) |_| { ... }
<mq32> but that only works for comptime known
<_Vi> What is idiomatic way to print (warn) N spaces where N is indentation level supplied as argument?
<_Vi> (function argument)
<mq32> ("\t" ** 50)[0..n]
<mq32> for values from 0..n
<mq32> otherwise you need an allocator
halosghost has quit [Quit: WeeChat 2.6]
FireFox317 has quit [Ping timeout: 240 seconds]
<daurnimator> andrewrk: ==> WARNING: Package contains reference to $srcdir
<ceymard> congrats on 0.5.0 to andrewrk and all the contributors
<daurnimator> scientes: I have no idea about M-profile: how would I tell?
<fengb> daurnimator: you're up early :P
<scientes> daurnimator, i actually contacted someone at ARM and got a response
<scientes> there is no silicon yet
<daurnimator> fengb: yeah adjusting myself for an early flight tomorrow
<fengb> Fun vacation plan?
<daurnimator> fengb: nope; conferences
<daurnimator> I'll be in europe for 2 weeks, so if anyone wants to do an impromptue zig meetup...
Ichorio has joined #zig
<scientes> Europe is a kinda big place....
LargeEpsilon has joined #zig
<daurnimator> scientes: I'll be in germany, austria, netherlands, france, italy and UK at various times and most of it is flexible.
<scientes> dang
<scientes> that's alot of places in 2 weeks
<daurnimator> scientes: still not that big of an area :P it's barely bigger than my state :P
<scientes> bigger than Texas
* daurnimator is Australian
<scientes> oh, those are state's too
<ceymard> files can have container members ?
<ceymard> does that mean they can be used like a struct ?
<ceymard> with methods and fields and such
<daurnimator> ceymard: yes
<daurnimator> ceymard: a file is just the "inside" of a struct.
LargeEpsilon has quit [Ping timeout: 240 seconds]
<ceymard> how may a method target the file as its self type
<ceymard> I mean, what's the type of the struct
<ceymard> @This() ?
<tgschultz> Yes
<ceymard> can they be extern as well ? (I suppose not ?)
<daurnimator> ceymard: `const somefile = @import("file.zig");` is the same as `const somefile = struct { .... contents of file here ..... }`
<ceymard> 'aight
<scientes> can i use access() in zig?
<scientes> (does it work on windows)?
<scientes> ok, I can do it cleaner
<scientes> actually, I would rather not have this data in zig
<scientes> os_file_exists
<scientes> so we don't use _access
<daurnimator> scientes: on windows an access check is just an open+a close
<scientes> yeah we already have os_file_exists
<daurnimator> oh you mean from c++; not from zig itself
<scientes> oh yeah, wasn't specific
<daurnimator> andrewrk: in the Support Table I think we should colour things; freestanding maxes out at tier 2, so we should indicate that as a "good" state
<scientes> so (void) doesn't silence the unused result....
<daurnimator> wow. I got 19 mentions in the release notes
<scientes> I got a bunch too
<daurnimator> I think LemonBoy gets the high score of 61 though :P
<mikdusan> 62. "LemonMan" was used once :)
<nrdmn> good evening!
<nrdmn> I missed most of the party
kllr_sbstn has joined #zig
kllr_sbstn has left #zig ["Leaving"]
<Sahnvour> nrdmn: the whole zig party is only beginning though :)
<nrdmn> :D
kllr_sbstn has joined #zig
<kllr_sbstn> Hey, is it possible to set a custom equals method for `std.testing.expectEqual`? I have structs containing floats, so the values don't need to be 100% exact.
Barabas has quit [Ping timeout: 260 seconds]
<daurnimator> kllr_sbstn: you would write your own helper around std.testing.expect
<kllr_sbstn> alright, i already do that. i thought there might be a a more 'clever' may. Thanks!
<kllr_sbstn> *way
<daurnimator> kllr_sbstn: expectEqual is simply a wrapper around expect itself
* scientes always uses expect
<daurnimator> scientes: expectEqual gives much nicer error messages. I use it when possible
<scientes> ahh i see
<fengb> I've noticed type inferrence to be much better when the literal is on the right :/
<Tetralux> When is it not?
<scientes> The CI is down
<scientes> gpg: keyserver receive failed: unknown pubkey algorithm
scientes has quit [Remote host closed the connection]
scientes has joined #zig
hasanyasin has joined #zig
<scientes> The CI is down
hasanyasin has quit [Ping timeout: 268 seconds]
porky11 has quit [Remote host closed the connection]
ltriant has joined #zig
LargeEpsilon has joined #zig
lukeholder has joined #zig
LargeEpsilon has quit [Ping timeout: 240 seconds]
kristoff_it has joined #zig
marijnfs_ has joined #zig
lukeholder has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kristoff_it has quit [Ping timeout: 240 seconds]
Ichorio has quit [Ping timeout: 252 seconds]
mahmudov has quit [Ping timeout: 276 seconds]
doublex has quit [Ping timeout: 264 seconds]
marijnfs_ has quit [Quit: WeeChat 2.6]
<daurnimator> zig W: Directory (usr/lib/zig/std/unicode) is empty
<daurnimator> zig W: Directory (usr/lib/zig/std/json) is empty
doublex has joined #zig
<daurnimator> uploaded zig 0.5.0 to arch community-staging. Still waiting for LLVM9 to finish QA before moving to community
<daurnimator> Arch users welcome to test :)
wootehfoot has quit [Quit: Leaving]
earnestly has quit [Ping timeout: 265 seconds]
<andrewrk> daurnimator, I'm annoyed at cmake for not letting me do a custom step on install
<fengb> How do I install the staging package? :/
<traviss> anyone know when the 0.5.0 binaries will be available?
<Tetralux> traviss: Already are AFAIK
<fengb> Should be downloadable already:
<traviss> oh thanks. i expected them on github
lukeholder has joined #zig
lukeholder has quit [Quit: Textual IRC Client:]
lukeholder has joined #zig
traviss has quit [Quit: Leaving]