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/
craigo has joined #zig
<ronsor> logical xor: xor(a, b) => (a && !b) || (!a && b)
frmdstryr has joined #zig
_whitelogger has joined #zig
sm2n has quit [Remote host closed the connection]
Biolunar has quit [Ping timeout: 244 seconds]
Biolunar has joined #zig
<gruebite> underscores for private struct members?
<gruebite> _member1
<andrewrk> no, just give it a descriptive name and document it clearly
<fengb> How about any field that has no docstring is considered private?
<lemmi> how do you document private fields then?
<ronsor> zig is like C: there are no real "private" fields
<leeward> Anything that isn't pub is private.
<leeward> Or are you talking about struct data?
<ronsor> struct data
<leeward> Yeah, there's no fake encapsulation there.
<leeward> You can take the public data and put it in a sub-struct and let people play with that, but it gets pretty hacky pretty fast.
betawaffle has quit [Ping timeout: 244 seconds]
guan has quit [Ping timeout: 256 seconds]
betawaffle has joined #zig
guan has joined #zig
wjlroe has quit [Ping timeout: 260 seconds]
wjlroe has joined #zig
<gruebite> well, there's still a convention regardless of language support, yeah?
<leeward> You're free to make one up. There isn't one in the coding standard.
<ronsor> I just note that you aren't supposed to mess with it.
<gruebite> any thoughts on making something a standard convention?
<ronsor> If some other dev thinks they have a fancy solution or problem that requires accessing it, that's their problem, not mine.
wjlroe has quit [Ping timeout: 244 seconds]
betawaffle has quit [Ping timeout: 244 seconds]
wjlroe has joined #zig
betawaffle has joined #zig
betawaffle has quit [Max SendQ exceeded]
betawaffle has joined #zig
guan has quit [Ping timeout: 272 seconds]
guan has joined #zig
traviss has quit [Remote host closed the connection]
traviss has joined #zig
_whitelogger has joined #zig
Biolunar has quit [Ping timeout: 244 seconds]
Biolunar has joined #zig
<gruebite> can you match on a tagged union by reference?
<daurnimator> what do you mean match?
<gruebite> if i have a pointer to a tagged union and switch on it i am led to: switch (un.*)
<daurnimator> gruebite: what's wrong with doing that?
<gruebite> is there a copy here?
<daurnimator> no
<gruebite> well then nothing :P
<daurnimator> though note.... a capture might be a copy (it didn't used to be; but then we got into aliasing troubles0
<daurnimator> so... make your captures by reference if you want that
<gruebite> Union.Foo => |*capture| ?
<daurnimator> i.e. `.Foo => |*foo|` if you want a reference
<gruebite> cool
<gruebite> thanks
_whitelogger has joined #zig
cole-h has joined #zig
ur5us has joined #zig
<daurnimator> andrewrk: I'm rewatching the stream now; just caught one of your replies to me I didn't when watching live
<daurnimator> re: vendored dependencies: its weird to me that everything in lib/ except for lib/std/ is vendored stuff
<andrewrk> the organization of lib/ is clear: it's all the files that is directly copied to the installation directory
<daurnimator> ah hmm; I haven't thought about it from that angle before
<daurnimator> hmmm. I just realised; it ends up in /usr/lib..... because its not architecture specific shouldn't it end up in /usr/share?
ur5us has quit [Ping timeout: 244 seconds]
<gruebite> i feel like try should have a high precedence
<gruebite> so i can do: try doFoo() * bar;
cole-h has quit [Quit: Goodbye]
<andrewrk> zig will require that to have parentheses. https://github.com/ziglang/zig/issues/114
dermetfan has joined #zig
_whitelogger has joined #zig
decentpenguin has quit [Quit: ZNC crashed or something]
decentpenguin has joined #zig
<andrewrk> LLVM Emit Output...error: <unknown>:0:0: in function mem.Allocator.reallocAtLeast void ({ %"[]hash_map.Entry", i16 }*, %mem.Allocator*, %"[]hash_map.Entry"*, i32): Non-Emscripten WebAssembly hasn't implemented __builtin_return_address
<andrewrk> oof
Ashpool has joined #zig
drawkula has joined #zig
yeti has quit [Ping timeout: 264 seconds]
dermetfan has quit [Ping timeout: 246 seconds]
drawkula is now known as yeti
<leeward> andrewrk: 114 doesn't make any mention of where `try` belongs. Personally, I think it should bind more tightly than arithmetic operations. `SomeErrors!u32` * u32 doesn't make any sense, and no arithmetic operators result in error unions.
<andrewrk> it's going to require parens with arithmetic ops
<leeward> It also adds symmetry, since `a + try foo()` if a is u32 and foo returns !u32
<leeward> Is that mentioned anywhere in 114? I can't find it.
<andrewrk> well I see your point, especially because there is no operator overloading. it would be abundantly obvious how to resolve that order of operations
<leeward> Yeah, operator overloading would change the picture dramatically, but it's completely off the table for Zig.
<leeward> Holy crap I just saw the timestamps. I should not be awake. To be continued.
marnix has joined #zig
KKRT has joined #zig
ur5us has joined #zig
dermetfan has joined #zig
ur5us has quit [Ping timeout: 260 seconds]
ifreund has quit [Read error: Connection reset by peer]
ifreund has joined #zig
Biolunar has quit [Ping timeout: 272 seconds]
<shakesoda> the need for parentheses on `try` has been one of those things i run into frequently that feels a bit absurd/unambiguous
marnix has quit [Ping timeout: 264 seconds]
cren has joined #zig
cren has quit [Read error: Connection reset by peer]
cren has joined #zig
cren has quit [Read error: No route to host]
cren has joined #zig
marnix has joined #zig
dermetfan has quit [Ping timeout: 256 seconds]
<Ristovski> What's the reason Zigs compiler doesnt do multithreaded compiling?
<Ristovski> even external C/C++ files seem to be compiled one by one
heitzmann has quit [Quit: WeeChat 2.9]
heitzmann has joined #zig
<ifreund> Ristovski: because the zig compiler you are currently using is the stage1 compiler written in C++
<ifreund> it's also horribly slow and a memory hog
<ifreund> the main focus of development currently is writing a self-hosted stage2 complier in Zig which will be much faster
<Ristovski> aah, I see
marnix has quit [Read error: Connection reset by peer]
ifreund has quit [Read error: Connection reset by peer]
ifreund has joined #zig
dermetfan has joined #zig
Biolunar has joined #zig
dermetfan has quit [Ping timeout: 260 seconds]
Ashpool_ has joined #zig
Ashpool has quit [Ping timeout: 265 seconds]
frmdstryr has quit [Ping timeout: 240 seconds]
pmwhite has quit [Remote host closed the connection]
pmwhite has joined #zig
wootehfoot has joined #zig
r4pr0n has quit [Quit: r4pr0n]
wootehfoot has quit [Read error: Connection reset by peer]
<danyspin97> How can I cast a []const u8 to []u8?
<Nypsie[m]> Create a new slice and copy over the bytes from the original []const u8 into the new []u8 slice. Altho, what are you trying to do?
<danyspin97> Nypsie[m]: i am trying to call std.fs.basename
<ifreund> hmm? fs.path.basename() takes a []const u8
cren has quit [Ping timeout: 246 seconds]
<danyspin97> ifreund: yup, but the problem is that exe is a []u8
<Nypsie[m]> I think what he's trying to achieve is to set the exe
<Nypsie[m]> basename returns a []const u8, but he's trying to save it as a []u8
<danyspin97> yea, that's the issue
<Nypsie[m]> You could resize exe using an allocator and then copy over the bytes into it from the result you got from basename()
<danyspin97> about the copy
<danyspin97> is it @memcpy?
<Nypsie[m]> Not sure if that works in this case, but std.mem.copy definitely does
<Nypsie[m]> (I never used @memcopy before)
<Nypsie[m]> std.mem.copy basically just loops over the slice and sets each value individually, so not the fastest way
<danyspin97> it compiles, thanks!
<danyspin97> the slice is 10-15 chars max, so it is fine
<Nypsie[m]> Architecture wise, you could probably solve this in an easier way
<ifreund> std.mem.copy() optimizes to @memcpy()
<ifreund> don't use @memcpy() without good reason
<ifreund> here you should just dupe() the slice that you get returned
<Nypsie[m]> Ooh good to know
<Nypsie[m]> Oof, completely forgot about dupe()
<danyspin97> yea, dupe is exactly what I needed
<danyspin97> thanks guys :)
KoljaKube has joined #zig
Ashpool__ has joined #zig
Ashpool_ has quit [Ping timeout: 240 seconds]
Ashpool__ is now known as Ashpool
cole-h has joined #zig
gpanders has quit [Read error: Connection reset by peer]
gpanders has joined #zig
<andrewrk> Ristovski, multithreaded compilation is on the todo list for self-hosted
<ronsor> I think using (try doFoo()) * bar is less confusing personally
<ronsor> hmm. I forgot to scroll dwon.
gruebite has quit [Quit: WeeChat 2.9]
waleee-cl has joined #zig
KoljaKube has quit [Ping timeout: 244 seconds]
<scientes> MLIR is built for multi-threaded
<scientes> (of course LLVM, which was designed for it, has mistakes that prevent it)
<andrewrk> MLIR is not the right tool for the job for zig
craigo has quit [Ping timeout: 264 seconds]
Ashpool_ has joined #zig
Ashpool has quit [Ping timeout: 264 seconds]
cren has joined #zig
KKRT has quit [Quit: KKRT]
cren has quit [Client Quit]
Ashpool__ has joined #zig
Ashpool__ is now known as Ashpool
wootehfoot has joined #zig
Ashpool_ has quit [Ping timeout: 264 seconds]
klltkr has joined #zig
<andrewrk> hmmmmm if Windows VirtualAlloc is giving us 64K aligned pages, that kind of implies that the page size is 64K not 1K
<Sahnvour> you mean 4K, not 1 ?
<andrewrk> yes, oops
<andrewrk> I think the tests will pass on #5998 now
<andrewrk> think about it: if you request 32K only from the page allocator, you basically have 32K of memory inaccessible. since VirtualAlloc will never return that second 32K because it is not 64K aligned
<andrewrk> may as well ask for all of it, right?
<Sahnvour> right, I remember bringing the point for the allocator allocating pages directly from the OS (don't remember the name)
<andrewrk> yeah. I think we have a lot of interesting improvements yet to be made to allocation in zig. I think the next step here is going to be making a series of gotta-go-fast benchmarks for allocation
<Sahnvour> also I discovered recently there's a VirtualAlloc2 that handles alignment, we might get rid of that loop in PageAllocator with it ? alas it's windows 10 only
cole-h has quit [Quit: Goodbye]
gpanders has quit [Quit: ZNC - https://znc.in]
<pixelherodev> Sahnvour: That still means improved performance on newer systems
<pixelherodev> Better than nothing
<Sahnvour> sure
<andrewrk> it's not necessarily better, it might just be doing the same logic we are
<andrewrk> unless it's an addition to NtDll
<Sahnvour> it is
<Sahnvour> hm, the docs says it's in kernel32, don't know if that makes a difference
Ashpool has quit [Quit: Leaving]
<shakesoda> andrewrk: general purpose allocator is exciting
adamkowalski has joined #zig
adamkowalski has quit [Quit: Lost terminal]
<andrewrk> shakesoda, about time, eh? :)
<shakesoda> yeah
<pixelherodev> Ah neat
<shakesoda> now if we can just get that 1717... ;)
<pixelherodev> Haha, yeah
wootehfoot has quit [Ping timeout: 256 seconds]
qazo has joined #zig