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/
<jaredmm> Can't wait for the day I don't have to troubleshoot another gd build that has "simple" build instructions that never work on the platforms they say they do.
traviss has joined #zig
<traviss> on windows, binary zig 0.5.0 is giving this error which i didn't see from binary 0.4.0: ...VCRUNTIME140_1.dll was not found... does anyone know what i need to do?
<traviss> i tried updating my VS build tools from VS installer but that didn't work. i have VS community 2017 installed btw (not updated recently).
kllr_sbstn has quit [Remote host closed the connection]
<traviss> .. along with VS build tools 2017. i updated both just now but that didn't seem to help.
<andrewrk> traviss, github updated
<traviss> thanks so much andrewk and everyone. amazing release!
lunamn_ has joined #zig
lunamn has quit [Ping timeout: 240 seconds]
<traviss> installing the visual c++ 2019 redistributable fixed my problem. i don't think i needed to do the updates i mentioned above. here is the link i used: https://aka.ms/vs/16/release/VC_redist.x64.exe
lukeholder has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 240 seconds]
hasanyasin has joined #zig
hasanyasin has quit [Ping timeout: 245 seconds]
kristoff_it has joined #zig
ntgg has joined #zig
kristoff_it has quit [Ping timeout: 268 seconds]
ntgg has quit [Ping timeout: 265 seconds]
<scientes> Yeah, my libmvec function works with armv7-32bit but not qemu
<scientes> as I was saying, qemu support for SIMD stuff is buggy
<knebulae> @andrewrk: I have been giving a lot of though to the comment about zig perhaps one day supporting its own inline assembler. Would it be possible to pass certain blocks to nasm for assembly? Of course this can be done with C function linkage, but then you have to abide by the C ABI. I'm thinking more a naked function with a nasm {....} block. It would be highly naughty though.
<scientes> damn i need that mips router i bought https://www.gl-inet.com/products/gl-mt300n/
<scientes> it supports mips SIMD
<scientes> allowing 2x16b
<scientes> or 4x8b operations to occur simultaneously.
<scientes> oh thats a differn't type of SIMD
<scientes> that's not the full thing: 16 x 8-bit, 8 x 16-bit, 4 x 32-bit, and 2 x 64
<shachaf> knebulae: Integrating an external assembler on that level seems very complicated and not worth the trouble.
<knebulae> That was what I figured :(
<knebulae> it'd have to be deep in llvm to make it play nice.
<scientes> yeah you can always link to those functions from zig
<scientes> using assembly if you want to do weird calling conventions
<shachaf> I feel like the benefits of inline assembly in the first place are pretty limited, when you have top-level assembly and intrinsics.
<knebulae> @shachaf: 99.99% of the time, yes. In my case, no. But it's all good. So many cool things in the new release.
drazan4 has joined #zig
drazan has quit [Ping timeout: 268 seconds]
hasanyasin has joined #zig
doublex has quit [Ping timeout: 245 seconds]
<scientes> should we have a signed version of truncate, and keeps the sign of the old number?
hasanyasin has quit []
doublex has joined #zig
<scientes> developing a memory model for comptime would really improve the usefulness of comptime
<scientes> or at least first, array indexing at comptime
<scientes> its a huge project
chemist69 has quit [Ping timeout: 276 seconds]
reductum has joined #zig
chemist69 has joined #zig
reductum has quit [Quit: WeeChat 2.6]
andrewrk has quit [Ping timeout: 240 seconds]
LargeEpsilon has joined #zig
adsr has quit [Quit: WeeChat 2.5]
LargeEpsilon has quit [Ping timeout: 265 seconds]
LargeEpsilon has joined #zig
LargeEpsilon_ has joined #zig
LargeEpsilon has quit [Ping timeout: 276 seconds]
ltriant has quit [Quit: leaving]
stratact has quit [Quit: Konversation terminated!]
earnestly has joined #zig
stratact has joined #zig
FireFox317 has joined #zig
stratact has quit [Remote host closed the connection]
stratact has joined #zig
FireFox317 has quit [Remote host closed the connection]
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 240 seconds]
konv has joined #zig
marijnfs_ has quit [Quit: WeeChat 2.6]
_Vi has quit [Ping timeout: 265 seconds]
avoidr has joined #zig
rappet has quit [Quit: -]
rappet has joined #zig
gustav_o has joined #zig
<gustav_o> hi!
<mq32> hey
<konv> o/
<gustav_o> 0.5.0 is looking great :) I started a project today and ran into a problem: what is the proper way to add a zig library (build.zig file) to the build process of a(nother) zig executable?
<lunamn_> b.addPackagePath?
avoidr has quit [Quit: leaving]
<mq32> ceymard, your code completion works pretty well!
<gustav_o> lunamn_thanks! the import seems to work, I just can't seem to access anything public though @import("mylibrary").hello where pub const hello = "hello world!"; exists in main.zig of mylibrary
<gustav_o> oh nm, I accidentally supplied the build.zig file to addPackagePath() instead of main.zig
Gertm has joined #zig
<Gertm> How much C knowledge does one need to get going with Zig?
<mq32> pretty much zero
<mq32> you should know how a computer works (in terms of memory, pointers, stack, heap)
<mq32> but you don't need to know syntax or semantics of C
<Gertm> Interesting! Thanks.
rifkik has joined #zig
tencho has joined #zig
<tencho> why do I get OutOfMemory https://godbolt.org/z/u2ubqo
<tencho> I mean I get OutOfMemory error on line 11. If I set a breakpoint in heap.zig:450 then self.buffer.len is 0. How ?
tencho has quit [Quit: WeeChat 1.4]
utzig has joined #zig
kenaryn has joined #zig
<kenaryn> Hello people, I'm reading the 0.5.0 release notes and new builtin @hasDecl in particular, but I do not know the meaning of the 'declaration' word? (i.d. in a programming sense). Is there someone who accepts to explain it to me please?
<kenaryn> Another question: is there a lexikon associated with the Parsin Expression Grammar? same implication as the previous one but in a higher abtract reasoning. Thank you.
<kenaryn> Parsing*
<mq32> hey kenaryn
<mq32> a declaration "declares" that a variable exists
<mq32> "hereby, i declare that a is a variable of type i32!"
<mq32> or in zig terms
<mq32> var a : i32;
<mq32> declarations "create" objects like variables or functions
_Vi has joined #zig
<kenaryn> Allright but does a function isn't a declaration too? like exposed by Andrew in the official documentation
<mq32> a function declaration is also a declaration ;)
<mq32> fn fun() void { } // this declares a function
<kenaryn> sorry, I missed your before-last sentence!
<kenaryn> I understand now, you are very kind mq32.
<gustav_o> Another question: is there a way to initialize all struct fields to 0 in zig?
Ekho has joined #zig
<mq32> @memset
<mq32> or std.mem.set
<mq32> or use default-initialization with 0
<fengb> Try not to memset arbitrarily. Zig has some built in safety, like slices, that could be overwritten
<fengb> Except packed structs and extern structs. They can probably be memset without worries since their memory layout is well defined
<gustav_o> how do I default-initialize with 0? this is a c struct so I cannot change the struct fields to have defaults
<fengb> Oh C structs are extern so doing memset is fine
<dingenskirchen> re: PEG grammar, kenaryn: https://github.com/PhilippeSigaud/Pegged/wiki/PEG-Basics#peg-basics is a nice summary of the syntax and meaning
<gustav_o> @fengb ok!
rifkik has quit [Read error: Connection reset by peer]
<gustav_o> Hm, I can't quite figure out how to add my library as a dependency of my executable. exe.addPackagePath("mylib", "../../src/main.zig"); makes it possible to import zig code from main.zig but how do I inherit the library declaration? Do I break out b.addStaticLibrary() into its own function in mylib build.zig and then call that from my executable
<gustav_o> build script?
<gustav_o> I want to specify lib.addCSourceFile("src/deps/mycfile.c", [_][]u8{}); etc only once in the build.zig of mylib, not in all places that use the lib
Barabas has joined #zig
ikan-keli_ has joined #zig
<gustav_o> Ok I worked around the problem by creating the executable inside of the library build script (these are "test" executables anyway), but I would be really interested to know the proper way to do this. Maybe it doesn't exist yet and it is waiting for the package manager?
ntgg has joined #zig
halosghost has joined #zig
ntgg has quit [Ping timeout: 276 seconds]
ntgg has joined #zig
<kenaryn> Thank you digenskirchen! This is very instructing :)
waleee-cl has joined #zig
doublex has quit [Ping timeout: 245 seconds]
doublex has joined #zig
shritesh has joined #zig
<shritesh> FYI homebrew has 0.5.0 now. `brew install zig` away.
shritesh has quit [Remote host closed the connection]
<fengb> Driveby announcement o_O
n_1-c_k has joined #zig
<Barabas> How would one extent functionality of an existing struct?
<Barabas> (Without changing the existing implementation, because that could be in some library.)
<n_1-c_k> Calling the nextPosix() function in ArgIterator got me this, https://paste.debian.net/1103497/ , am I doing it wrong? OS is debian stable.
kristoff_it has joined #zig
Akuli has joined #zig
LargeEpsilon_ has quit [Ping timeout: 265 seconds]
ntgg has quit [Ping timeout: 240 seconds]
lukeholder has joined #zig
ntgg has joined #zig
lukeholder has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
LargeEpsilon has joined #zig
<_Vi> Is comptime-unrolled loop of ifs, comparing x to large-ish set of constant numbers going to be as efficient as switch?
<fengb> I believe LLVM optimizes that into a jump table
<scientes> llvm is very conservative about jump tables
<scientes> i was working on it, but C++ is so slow
<scientes> you can't do a jump table out of that without a bit map
<scientes> which llvm doesn't implement
<scientes> so the switch just does binary search
<Barabas> in general a switch can't really be a jump table, unless you assume the default case never happens.
<Barabas> And no holes in your cases etc ^^
<scientes> yes it can
<Barabas> How does that work?
<scientes> use a bitmap
<scientes> that doesn't describe it well however
<halosghost> scientes: if you're working on it in C++, can you use the && GNU extension?
<scientes> I'm talking about the pain of hacking LLVM
<halosghost> ah
<halosghost> nevermind then :)
<_Vi> Is there reliable way to generate jump table with variable, but comptime-known number of variants?
<scientes> yes, fix llvm
<scientes> or pay me to finish the patch set I was working on
<_Vi> I mean using Zig things. Maybe there is something like `inline switch` besides `inline while`?
<scientes> you don't understand what switch is
THFKA4 has joined #zig
<scientes> llvm has to do it
<scientes> and inline makes no sense
<_Vi> Or does switch and a series of `if`s from zig-unrolled loop lower to the same LLVM IR anyway?
<fengb> Hmm it's not optimizing my simple case :(
<Barabas> Can't say I fully understand what the code does there in the bugreport, but I'll take your word for it ^^
<scientes> yeah that doesn't describe it well
ntgg has quit [Ping timeout: 265 seconds]
<Barabas> hmm... I think I get it.
<fengb> scientes: I think _Vi wants to generate switch branches using a loop
<_Vi> Yes.
<scientes> ooooo
<scientes> good question
<scientes> yeah, make up a proposal
<scientes> but keep in mind that the llvm switch interface sucks
<scientes> but i gues we can just ignore that
<scientes> gcc's is better
<_Vi> Is that `llvm switch interface` the only way to make it generate jump table or it can also do it from equivalent series of `if`s?
<scientes> i don't believe llvm generates switch statements
<Barabas> fengb what's it doing with lea there?
<scientes> but i could be wrong
<scientes> but yeah that is probably the way to do it
<Barabas> fengb lol, if you change `x - 1` to `num - 1` it does optimize it :P
<fengb> Oh that makes sense
<fengb> Wait... it means you can't use the switch match in the body :(
<Barabas> Well... x and num should be the same. The compiler should know that, but hey... it's a compiler :D
<fengb> I was hoping LLVM would recognize this as a switch
<scientes> fengb, you just have to write the patch to llvm
<scientes> i think this is the way to do it
<_Vi> Is converting the big switch to a jump table implemented in Zig code (without relying on LLVM) a good idea?
<scientes> no
<_Vi> Will the big chain of `if (x == 0x123456) return MyEnum.Var1;`-like things (more than 200 items) be optimized by LLVM somehow (even if it is not a jump table)?
<fengb> Only way to be sure is inspecting the output
<mq32> _Vi, it's not a good idea to specify what optimizations are guaranteed
<mq32> because this would prevent optimal code generation
<_Vi> Tried godbolting a switch with 19 variants and observing a lot of `cmp`s and conditional jumps.
<mq32> it's probably better for the pipeline than a jump table
<mq32> as jump tables are more common to enforce pipeline stalling
<fengb> Well... chained conditional jumps are worse than jump tables
<Tetralux> mq32: I hear this a lot; the point about not tying the hands of the compiler; I've yet to see any actual evidence that this is actually true. Indeed, more the opposite.
<mq32> Tetralux: i once "optimized" my code from what the compiler did to a jump table
<Tetralux> It was slower?
<mq32> yes
<mq32> by factor 3
<Tetralux> That's because jump tables are terrible xD
<Tetralux> if-else branches are better.
<Tetralux> It's okay if you've got like 20,000 arms
<Tetralux> But not for like 10.
<mq32> yeah but even then the compiler would have emitted the same code as for the switch ^^
<mq32> i had 256
<Tetralux> I've never measured personally where the threshold is.
<Tetralux> So I can only really guess, in part.
<Tetralux> Point is, jump tables aren't worth the optimization to unless you've got a lot of them.
<Tetralux> Like - thousands, probably.
<mq32> yeah
<Barabas> Why are they so slow?
<Tetralux> Cache probably.
<mq32> because of how modern CPUs work
<Tetralux> Both instruction and memory.
<Tetralux> But yes
<Tetralux> Also the branch predictor
<mq32> cache, pipeline, lookahead, branch predictor
<fengb> It really depends. Jump table forces 2 unpredicable branches
<_Vi> Tried comparing switch and ifs: https://zig.godbolt.org/z/D77QPC Is switch better?
<Tetralux> mq32: This.
<fengb> But if your if-else chain has a jump per branch, it's possibly slower already
<_Vi> Will it be similar for 200 variants instead of 18?
<mq32> btw, is our BDFL taking a break? he isn't here in the IRC :D
<Barabas> wait, a jump table is computed goto
kenaryn has left #zig ["(The show must go on!)"]
<Barabas> right?
<fengb> For instance, my emulator core is better as a jump table because each branch is complex and the cache doesn't help too much
<fengb> Barabas: computed goto is an optimization step beyond jump table but they're related yeah
<Barabas> Yes I can see that. I once helped optimize some vm thingy to generate computed goto's for the instruction handling and it got 30% faster in some cases.
<Barabas> ok
<fengb> It really depends on cache characteristics. If you have one branch that's hit often, pushing that to the top and prevent jumps is much faster than anythiing else
<Barabas> Yeah I can see that.
<fengb> Or if each branch is not actually jumping, if-else chain would always be faster
<Tetralux> I did hear that someone wrote a parser as a jump table and then rewrote it as--I think it was recursive-decent; it went from 60 to 2 ms.
<Barabas> ^^
<Tetralux> Anecdotal of course, but.
<Tetralux> That is somewhat representative, is my point.
<_Vi> In a big series of `if(num == <comptime_int>) return <comptime_int>;`, is it advisable to place popular variants at the top or optimiser would shuffle them anyway?
<Barabas> I once 'optimized' something from a virtual function call to just calling a function pointer. Thinking that would be less lookups... but eh... it was twice as slow xD
<Tetralux> I'd suggest you always help the optimizer in any way you can.
<mq32> Barabas: c++ can optimize most virtual function calls away if the type is inferrable
<Barabas> It wasn't.
<Tetralux> Isn't a virt call the same as calling a fn ptr?
<mq32> Tetralux, double dispatch
<Tetralux> Except with one extra vtable lookup potentially.
<mq32> you look up the vtable, then look up the fnptr
<mq32> but: vtable can be cached for a whole function or even call tree
<Barabas> Yeah, that's probably why the virtual function was faster.
<Tetralux> That sounds like their just the same - except that the compiler set it up and so can optimize it to a static call.
<Barabas> virtual function call is
<Tetralux> In which case, "optimizing" to a fn ptr call would end up with manual-fn-ptr-call vs optimized-to-static-call
<Barabas> vtable->function(args)
<Tetralux> i.e: get rid of the fn ptr altogether.
<Barabas> kinda... plus some offset
<Tetralux> You want everything to be static calls.
<Tetralux> Everything.
<Barabas> sure
<Barabas> but a virtual function call is not static... unless it knows what actual type it is.
<Tetralux> That's why I avoid them :)
<Barabas> duh
<Barabas> We use them a lot at work, because we mock out half the things for unit testing =|
<Barabas> And then you get into arguments about making classes final and ugh
<Tetralux> Yeah just make everything static. xD
<Tetralux> It's so much easier.
<Tetralux> And faster.
<Tetralux> If you're gonna complicate things with abstractions - use ones that are actually good to begin with.
<via> would it be possible to instead of having the concept of interfaces use function pointers to instead build them at comptime like generics? like an outstream that takes in a comptime writeFn
<Tetralux> That's my ideal scenario.
<Tetralux> I believe gonz_ has a way of doing that now.
<fengb> Yes, comptime duck typing works pretty well
<via> i mean, i haven't tried it, is there anything in the language preventing that? also specifically maybe having the fact that its async or not be comptime?
<fengb> I allow any var that matches instream or outstream
LargeEpsilon has quit [Ping timeout: 276 seconds]
<via> i'm not clear on how thats working, is that type checked at compile time?
_Vi has quit [Ping timeout: 265 seconds]
<gustav_o> What do you guys think about "Default Struct Field Values" for C structs? That way one can initialize a C struct in zig just like in C (omitting fields that should be 0)
<via> fengb: if that works, i still think a genericed stream interface would look better, so that function type signatures indicate what its actually taking
LargeEpsilon has joined #zig
avoidr has joined #zig
<fengb> via: yeah it’s typechecked by ensuring the method exists
<fengb> Not the best type checking. There’s a proposal for comptime checked types
LargeEpsilon has quit [Ping timeout: 240 seconds]
<via> cool
<via> it occured to me since i wrote what i did that comptime generic streams won't work, because everywhere that wanted to take a stream would need to know what function it writes with
gustav_o has quit [Remote host closed the connection]
_Vi has joined #zig
mahmudov has joined #zig
ntgg has joined #zig
dec0de has joined #zig
<dec0de> Hey guys, can I help you with the website? I am a programmer and I really like the idea of zig! But the website needs some work, maybe I can help on that? (Feee ofcourse)
<dec0de> *free
<nrdmn> dec0de: what do you think could be improved?
<dec0de> The design layout and everything, right now it looks like a html only site
<dec0de> While the top bar looks good, the text as no margin, which makes it harder to read
<donpdonp> dec0de: it might be better to simply fork the site, make some edits, then post a link here saying Hey doesnt this look better?
<Sahnvour> dec0de: I think many people here like the fact that it's html-only, but feel free to propose improvements to https://github.com/ziglang/www.ziglang.org
<nrdmn> it is a html only site (not counting css). No Javascript, no serverside processing.
<nrdmn> I think there could be something done about the legibility, but that's up to Andrew to decide
marijnfs has joined #zig
<nrdmn> the paragraph headings kinda disappear when scrolling quickly over the main page
andrewrk has joined #zig
<traviss> via: what your twitch channel?
ntgg has quit [Ping timeout: 240 seconds]
<dec0de> Guys, I am not looking into making a heavy slow loading site
<andrewrk> dec0de, if you're looking for "blessing" before starting on such a project, you won't get one. your options are to do such work no-strings-attached and hope it gets merged, or to be content with status quo
<mq32> wb andrewrk!
<andrewrk> thanks. the hard drive on my home server finally died and I had to move some stuff
<andrewrk> lost all my music, most recent backup is years old :(
<konv> damn
<konv> also no js is good
<andrewrk> I want to point out the entire home page is 22 KB transferred with a cold cache
itsMontoya has joined #zig
<mq32> damn, my sympathies! lost a lot of projects due to a dropbox bugs years ago. sucked...
<itsMontoya> Hey andrewrk, do you have a slack and/or discord for Zig? Or is IRC the primary?
<itsMontoya> Thanks konv!
<konv> :D
traviss has quit [Quit: Leaving]
<marijnfs> andrewrk: dam, I made a backup tool in c++, I should port it to Zig
<itsMontoya> Is there anyone familiar with the async changes in .5? Or is it only andrew?
<itsMontoya> I wanted to code up a simple PoC messing with async changes
<konv> You can watch the livestreams
<itsMontoya> I was watching the last livestream and at the time he only had io.Read
<konv> watch the last two
<itsMontoya> Working
<itsMontoya> He said Write was still not done, but should have been before .5 release
<andrewrk> itsMontoya, there is a lot more to do as far as async/await stuff goes
<andrewrk> choosing evented I/O mode is still experimental
<itsMontoya> Is there any way to utilize async with a timer?
<itsMontoya> Let's say I wanted to fork a thread, sleep for 3 seconds
<itsMontoya> then return "hello world"
kristoff_it has quit [Remote host closed the connection]
<andrewrk> yes
ntgg has joined #zig
<itsMontoya> Ok, I'll re-watch the latest live stream and try to figure it out
<itsMontoya> Do you know roughly how far in you showed enough example for me to reference for this PoC?
<itsMontoya> Or even a gist of a code example
<andrewrk> itsMontoya, yeah let me put together a gist of the example
kristoff_it has joined #zig
Ichorio has joined #zig
<itsMontoya> Thanks man :)
<itsMontoya> I'm really excited for these changes
<itsMontoya> If I get comfortable enough, maybe I can assist with an http server lib
<andrewrk> that will be valuable because that's one of the next things we need for the package manager :)
<andrewrk> itsMontoya, here's the example. I'm transcribing it now; I didn't keep any copies around on my system. https://youtu.be/YaROde0UESo?t=1153
<scientes> I'm more interested in language features, rather than icing on the cake
<scientes> like I want comptime to work with a memory model
<andrewrk> scientes, yeah that's a high priority
<scientes> and libmvec needs symbol multi-versioning
<scientes> with hardware detection
<itsMontoya> OH this is great andrewrk
<itsMontoya> So anything can be async func if it has a suspend block?
<itsMontoya> Is that the determining factor?
kristoff_it has quit [Remote host closed the connection]
traviss has joined #zig
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 265 seconds]
<andrewrk> itsMontoya, yes, if it has a suspend point: https://ziglang.org/documentation/master/#Async-Functions
Akuli has quit [Quit: Leaving]
<scientes> <optimized out>
n_1-c_k has left #zig ["WeeChat 2.6"]
_Vi has quit [Ping timeout: 276 seconds]
<mq32> andrewrk, i have hacked together some "real coroutines" (so: "threads light") with the new async/await stuff: https://gist.github.com/MasterQ32/e732b1a74f60dc0cdbc0e2f0cf8898f6
<mq32> is this the right way to use resume/suspend?
<mq32> (i know it's not the intended one)
<andrewrk> mq32, in your comment you suggest that storing frames in main() instead of the heap is problematic - actually the way you have it now is better
<andrewrk> why heap allocate when you don't need to?
<mq32> yeah for my example it works with storing it in main
<andrewrk> unless in a real usage, main() would return and you want the frames to live
<mq32> but for a more dynamic system (with different coroutines/thread functions)
<mq32> so when i have something like "player_loop" and "enemy_loop"
<andrewrk> that's a neat example
<mq32> those functions would have different frames, but could be suspended with the same scheduler logic
<mq32> but yeah, you're right. for the example, non-heap allocation is the right thing to do
kllr_sbstn has joined #zig
<mq32> i'm still not happy with the solution in my snippet. probably improving the whole code until i am :D
<mq32> no, my code right now is single threaded
<mq32> there is nothing "racing" against each other
<mq32> i'm even thinking about removing the need for a coroutine parameter and just set it globally *grin*
<itsMontoya> Right, but if this goes to multi threaded. That would need to be atomically set, correct?
<mq32> it would be much more complicated in a multithreaded environment
<mq32> there would be at least two variables required
<mq32> and some mutexes probably as wel
<itsMontoya> Totally, I was just thinking about future use. This is very cool though
<mq32> the coroutine would announce: "i am about to quit", then a scheduler has to remove that coroutine and shut it down safely
<mq32> my thought was actually cloning the Gamestudio API
<mq32> which uses coroutine for entity logic
<mq32> where you can write fully imperative, straight forward code for each entity and run them in parallel, with a function that "waits" a frame
<mq32> sadly, this is horribly implemented in the original engine and explodes as soon as you do *anything*
<itsMontoya> OH
<itsMontoya> Very interesting
<mq32> the concept is great, but semantics were much underdefined
<mq32> as i wanted to play around with zig and OpenGL, i could hack some simple demo together using such a system
<itsMontoya> hello_world/main.zig:6:20: note: referenced here
<itsMontoya> Is the error supposed to be this vague?
ntgg has quit [Ping timeout: 240 seconds]
<mq32> this is not an error, but a note
<mq32> i think there's stuff missing
<andrewrk> itsMontoya, scroll up, the error notes are a bit out of control at the moment
<itsMontoya> Oh ok
<itsMontoya> Nothing is running, so I figured my note was causing an issue
halosghost has quit [Quit: WeeChat 2.6]
<andrewrk> notes are attached to errors
<itsMontoya> Ah ok
<itsMontoya> w00t
<itsMontoya> Compiled!
<itsMontoya> error: container 'std.os' has no member called 'time'
<itsMontoya> Did this update?
<itsMontoya> OH
<andrewrk> it's now std.time
<itsMontoya> I just saw it in your youtube lol
<itsMontoya> Sorry
<itsMontoya> "Oh! No os anymore"
<andrewrk> no worries :)
avoidr has quit [Quit: leaving]
<itsMontoya> Is there any documentation on time lib?
<itsMontoya> Like it's available funcs/structs
<Tetralux> Nothing for anything, basically still.
<andrewrk> I've an idea to make std lib docs happen soon
<Tetralux> But `var t = time.Timer.start(); var time_since_start = t.read();` is useful to know :)
<Tetralux> .. time_since_starts is in nanos
<mq32> <andrewrk> I've an idea to make std lib docs happen soon
<mq32> ♥
<companion_cube> sr.ht has this cool feature of hyperlinks between source files, wonder if the stdlib docs could have something similar…
<Sahnvour> andrewrk: can we get more details ?
<andrewrk> Sahnvour, stage1 dump json. self-hosted code parse & format into docs
<andrewrk> the process will be to do the stage1 json dump multiple times, and the self-hosted code will merge multiple & process multiple dumps ("multibuilds")
<andrewrk> this way at least a large portion of the code can get re-used when we self-host
<andrewrk> this will also help with IDE integration until self-hosted is available
<itsMontoya> Hey andrewrk, I feel like I'm close
<itsMontoya> Would you mind nudging me in the right direction?
<andrewrk> itsMontoya, your addSlow function is resuming itself, it may as well be written to just do time.sleep(ns); x += 1; - you're not actually taking advantage of async functions
<andrewrk> we also have std.time.ns_per_s
<itsMontoya> So what I wanted to simulate was a long task and waiting for it
<itsMontoya> Maybe I had another thread
<itsMontoya> do long task
<itsMontoya> and I could call await on it from the main thread
<itsMontoya> So I figured that was how I was supposed to handle it
<andrewrk> itsMontoya, look at @typeOf(frame), I think you may be surprised
<mq32> <andrewrk> Sahnvour, stage1 dump json. self-hosted code parse & format into docs
<mq32> this is a cool approach for "multibuilds"
<andrewrk> mq32, this way inferred error sets, for example, will be correct even if the set is different across windows and linux
<itsMontoya> Even though I'm not utilizing async per-say. How would I need to adjust this?
<mq32> i imagine some documentation where for each function, there is a marker like "Win32: error{OutOfSpace}, Linux: error{OutOfSpace,OutOfTIme}"
<andrewrk> itsMontoya, the idea is to do the work on another thread right?
<itsMontoya> The next step is forking a thread, making the work occur on that thread
<itsMontoya> YEa
<andrewrk> did you see the code from the video at the time that I linked to?
<itsMontoya> I'll watch it now
<andrewrk> just that one frame, look at the code
<itsMontoya> I have the screen open and I was referencing the code
<itsMontoya> sleepThreadRun?
<andrewrk> you can actually make a function `switchToAnotherThread();` with zig's async
<itsMontoya> OH
<itsMontoya> I see how you did it
<andrewrk> this will be especially useful with e.g. switchToGuiThread();
<itsMontoya> $ zig run main.zig
<itsMontoya> 1 + 2 + 3 + 4 = 10
<itsMontoya> Yay!
<andrewrk> scientes, I'm going to try to merge 1 commit from your SIMD branch into zig per day
<mq32> that sounds like basic math is still working :D
<itsMontoya> mq32, aysnc math in another thread :D
<mq32> ^^
<andrewrk> `await` and `return` are lock-free and thread-safe; go nuts
<itsMontoya> Whoa!
<andrewrk> also `suspend` and `resume`, which don't even require an atomic instruction
<itsMontoya> Does zig have interfaces or impl?
<andrewrk> no
<andrewrk> that part of the language is not stable
<itsMontoya> Ah ok
<itsMontoya> So for now, I'd lean on generics?
<andrewrk> see for example std.mem.Allocator
<itsMontoya> I'll check it out :)
<itsMontoya> This is really cool stuff
<itsMontoya> Nice work andrewrk
konv has quit [Ping timeout: 240 seconds]
utzig has quit [Quit: leaving]
<Sahnvour> andrewrk: just updated to master and I get `lib\std\debug.zig:227:9: error: invalid builtin function: 'atomicRmw'` when building libuserland, on windows
<Sahnvour> did I miss something ?
<kllr_sbstn> andrewrk: is there any reason why there are consts for e and pi (in std.math) but not for M_PI_2, M_PI_4, M_SQRT2 and so on? I could create a pull request for that
<Sahnvour> itsMontoya: this concerns zig's std lib, the error I get is from the stage1 compiler
<itsMontoya> OH! Sorry
<Sahnvour> leaving for tonight, will investigate tomorrow if I find some time
<Sahnvour> no problem :)
<itsMontoya> Have a nice evening friend!
marijnfs has quit [Quit: WeeChat 2.6]
mahmudov has quit [Ping timeout: 240 seconds]
Barabas has quit [Ping timeout: 260 seconds]
ntgg has joined #zig
<andrewrk> Sahnvour: I think you're hitting the MSVC bad codegen bug
<andrewrk> I had to change the CI server to MinSizeRel to work around this
mahmudov has joined #zig
<andrewrk> I looked at the relevant code and I don't think we're invoking UB. It appears to be a legit bug that Microsoft has acknowledged and is fixing
dingenskirchen has quit [Remote host closed the connection]
ltriant has joined #zig
kllr_sbstn has quit [Remote host closed the connection]
Ichorio has quit [Ping timeout: 264 seconds]
doublex has quit [Ping timeout: 264 seconds]
doublex has joined #zig
earnestly has quit [Ping timeout: 240 seconds]
ntgg has quit [Ping timeout: 240 seconds]