ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<andrewrk>
j`ey, the builds on the download page are only ~25 MiB zipped, and you can just unzip and run zig. it should be painless to have zig running on your computer
<andrewrk>
they're up to date too. CI updates the page after every commit, if the tests pass
<j`ey>
cool, I may take a look, if godbolt gets too annoying :)
<andrewrk>
godbolt is a liiiitle out of date. it doesn't have the big syntax revert yet
<andrewrk>
to be clear that wasn't sarcasm. it's only a couple weeks old
<j`ey>
how does godbolt get new releases?
<andrewrk>
I believe there is a script that runs semi-regularly and downloads the latest off the zig download page
suirad has quit [Ping timeout: 256 seconds]
<benjikun>
andrewrk: Do you think we'll get a regex in stdlib?
<andrewrk>
my goal is to have one that supports compiling the regexes at compile time
<andrewrk>
idk about what flavor yet
<benjikun>
true that'd be nice
jmiven has quit [Quit: co'o]
<daurnimator>
If you're going to have them in the stdlib then please use a non-backtracking implementation. e.g. re2
porky11 has quit [Quit: Leaving]
suirad has joined #zig
return0e has quit [Read error: Connection reset by peer]
return0e has joined #zig
wilsonk has quit [Read error: No route to host]
<daurnimator>
misc idea: could @This() take an index so you could refer to a parent?
<MajorLag>
That'll get confusing. Common practice is to put something like `const Self = @This();` in each struct that needs it. So you could do `const OuterSelf = @This();` ... `const InnerSelf = @This();` or something like that.
m4ge123 has left #zig [#zig]
<daurnimator>
MajorLag: yeah that's what I did.... gets a little ugly. would be nicer if @This() took a parameter :)
<hryx>
Hey friendos, I'm making progress on docgen (#21) despite my heavy dayjob schedule! But I'm struggling a bit with something that maybe you can help me with.
<hryx>
I need to read/tokenize/parse a root source file, resolve its imports, then repeat until the AST is complete.
<hryx>
From what I can tell there isn't any single function in analyze.hpp dedicated to this, and to be honest I don't totally grasp whether I should be using the CodeGen functions for this or not -- there's no code generation involved here, but the CodeGen type seems central to many of the current multi-phase operations.
<hryx>
Any tips would be greatly appreciated!
<andrewrk>
hryx, the functions that are in codegen.cpp and analyze.cpp are admittedly not organized in any particular fashion. everything is kinda global
<andrewrk>
hryx, have you looked at ir_analyze_instruction_import?
<andrewrk>
that function calls file_fetch, add_source_file, scan_import
<hryx>
That one, I don't think so -- I'll go peep it right now
<hryx>
ok that sounds promising
<andrewrk>
all 0.4.0 proposals have either been accepted, rejected, or postponed
<hryx>
glorious. for me it was an educational flurry of email notifications
emekoi has quit [Ping timeout: 256 seconds]
<benjikun>
same for me hryx
<benjikun>
and scrolling down my github feed
<hryx>
heh!
jjido has joined #zig
Zaab1t has joined #zig
jjido has quit [Remote host closed the connection]
<nbjoerg>
andrewrk: those lists look more like you want access to the base architecture?
* daurnimator
looks around.... anyone here?
alehander42 has quit [Quit: Connection closed for inactivity]
<hio>
what do you guys think about this capability of other languages: `var newList = oldList.Where(item => item == "hi");` and then it will return a new list with only those items? this feature would be called closures or anonymous functions right?
d_s_ has joined #zig
d_s has quit [Read error: Connection reset by peer]
<MajorLag>
hio, see: https://github.com/ziglang/zig/issues/1048 for a lot of discussion on the topic. Anonymous functions are something that may happen, but I'm doubtful closures will.
<hryx>
hio: that statement would require an anonymous function (not necessarily a closure), but more importantly it would be allocating a new list. In zig, there aren't any hidden or "automatic" allocations - the programmer would need to supply the space or an allocator object
<hryx>
oops, beat me to it
porky11 has quit [Quit: Leaving]
errpr has joined #zig
<hio>
hm how can this be made more convenient.. would be nice if it could feel like a managed language from a convenience viewpoint
<MajorLag>
does anyone know why you need an else prong when switching on a bool? that seems like an oversight.
<errpr>
seems odd to switch on a bool, isn't that an if?
<j`ey>
var newList = oldList.Where(item => item
<j`ey>
woops
<j`ey>
var newList = oldList.Where(item => item == "hi").collect(allocator);
<j`ey>
that'd be nice
<hio>
it would still be more to type, is there really no other way? What if I could declare an allocator for a function and then it would allow me to call all functions without having to explicitly pass that allocator every single time
<hio>
(just for the duration of that function)
<j`ey>
I dont like that kinda implicitness
<hio>
it's only implicit for a single function and you dont have to use it
<hio>
you could make it implicit for even just a single if block
<hio>
I believe jai has something similar but I dont remember anything about it, I just had that idea based on something he said
<hio>
I think with jailang he passes in a context to every function automatically
<j`ey>
thing is, the allocator is passed in as an argument to a function
<j`ey>
so you'd have to pass an the argument to the right parameter magically
<hio>
yeah, idk how the compiler would do that but it would be nice
<j`ey>
too magic for me
<hio>
well then what is your view on coroutines because those look like magic too
<j`ey>
yeah that's also a big magic, but it's defined to be like that
<j`ey>
allocators are just 'normal' objects, nothing special
<hio>
ok i have an idea how it could be implemented
<j`ey>
yeah?
<hio>
make it an optional argument and then the compiler will use the local allocator if it was defined at a function level
<j`ey>
or some kind of naned argument
<j`ey>
named
Zaab1t has quit [Quit: bye bye friends]
<MajorLag>
errpr, when used for assignment, I find there are cases where switch(bool) is more readable than if(bool). Specifically if your value expressions are long enough to run over the soft line limit, but short enough to fit if separated.
<andrewrk>
MajorLag, yes, 0.4.0 can't ship without stack traces working again
<andrewrk>
I'm sure it's a reasonably straigthforward fix. it's just hard mentally for me to context switch when I'm deep in copy elision
<andrewrk>
I'm guessing llvm/lld is generating slightly different PDB and zig's debug info code needs to adjust to it
<andrewrk>
hio, coroutines are going to look much less like magic after the rewrite. it will be perfectly clear where they're getting their memory from
errpr has quit [Ping timeout: 260 seconds]
<MajorLag>
andrewrk, should we maybe have a "easy fix" tag or something like it to flag bugs that are low priority and could be a good starting point for people looking to work on the compiler?
<andrewrk>
MajorLag, yes I think it's time we have that. I've started using "help wanted" since GitHub recommends those in the UI. Do you think we should rename it?
<andrewrk>
although I tagged the valgrind issue "help wanted". I guess I also used it as "this requires skills other than intimate zig knowledge"
<MajorLag>
I'm not sure. I don't think it communicates well that the problem is probably low-hanging fruit. I imagine it would be used in places where maybe the problem domain isn't well understood by regular contributors.
<andrewrk>
I'm open to suggestions
<MajorLag>
I'll try to think of some. Naming things is hard.
<andrewrk>
agreed
<andrewrk>
whew. just got @bitCast working with copy elision. it seems every semantic construct is a new puzzle to be solved
<andrewrk>
it's pretty sweet though - @bitCast doesn't ever introduce copying, it ends up just turning into a pointer cast
<andrewrk>
and that's guaranteed - pre-optimization
<andrewrk>
oh interesting, with const values it's now hitting error: TODO handle comptime reinterpreted pointer
<andrewrk>
which makes sense
errpr has joined #zig
wink_ has joined #zig
<andrewrk>
MajorLag, I renamed "help wanted" to "contributor friendly" with the description "This issue is limited in scope and/or knowledge of Zig internals."