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/
_Vi has quit [Ping timeout: 260 seconds]
shcv has quit [Ping timeout: 260 seconds]
alexnask has quit [Quit: Leaving]
marijnfs has joined #zig
marijnfs1 has quit [Ping timeout: 258 seconds]
nephele_ has joined #zig
nephele has quit [Ping timeout: 272 seconds]
nephele_ is now known as nephele
xackus has quit [Ping timeout: 260 seconds]
xackus has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
<pixelherodev> Is there a way to differentiate between ErrorSet1.Error1 and ErrorSet2.Error1
<pixelherodev> ?
reductum has joined #zig
<rooke> My read from the documentation is no, but I could be wrong... "However, each error name across the entire compilation gets assigned an unsigned integer greater than 0. You are allowed to declare the same error name more than once, and if you do, it gets assigned the same integer value."
<rooke> Is the particular line
<pixelherodev> Yeah, that's what I figured
<daurnimator> pixelherodev: you can't: they're the same
<daurnimator> note the name: error sets. its the same value in a different set
<pixelherodev> Right
<pixelherodev> Makes sense
fraktor has quit [Ping timeout: 265 seconds]
nycex- has joined #zig
nycex has quit [Ping timeout: 240 seconds]
reductum has quit [Ping timeout: 246 seconds]
tsmall has quit [Ping timeout: 246 seconds]
dddddd has quit [Ping timeout: 246 seconds]
st4ll1 has joined #zig
marnix has joined #zig
marnix has quit [Ping timeout: 265 seconds]
cole-h has quit [Quit: Goodbye]
drp has joined #zig
daex has quit [Ping timeout: 265 seconds]
marnix has joined #zig
daex has joined #zig
dermetfan has joined #zig
Kingsquee has joined #zig
manuzor has joined #zig
drewr has quit [Ping timeout: 260 seconds]
drewr has joined #zig
tdc has joined #zig
haliucinas has quit [Remote host closed the connection]
marnix has quit [Ping timeout: 264 seconds]
haliucinas has joined #zig
ifreund has quit [Ping timeout: 265 seconds]
pangey has joined #zig
daex has quit [Ping timeout: 256 seconds]
daex has joined #zig
ifreund has joined #zig
_Vi has joined #zig
Snetry has quit [Ping timeout: 246 seconds]
Snetry has joined #zig
<nerthus> do you guys happen to know why the zig extension for vscode sometimes work and sometimes doesnt
<nerthus> extension host says extension startup fails
<nerthus> and it's only with the zig extension that this happens T_T
<Kingsquee> because it's not written in rust?
* Kingsquee shot
<ifreund> it's a vscode extention, it's JS
<nerthus> vscode is hard to debug as well
<nerthus> it gives you a bunch of obfuscated JS to look through
<nerthus> frustrating part is, is that I literally just restored it from a backup that worked fine
<nerthus> lmao
WilhelmVonWeiner has quit [Ping timeout: 272 seconds]
bgiannan has quit [Ping timeout: 244 seconds]
HollMax has joined #zig
KoljaKube has joined #zig
Kingsquee has quit [Quit: Konversation terminated!]
<KoljaKube> Is const-ness part of `type`s?
<KoljaKube> Basically what I'm trying to accomplish is having a generic structure that can enforce const-ness of slice function parameters depending on how it was initialized
halbeno_ has quit [Ping timeout: 260 seconds]
<ifreund> yes, `[]const u8` is a type
<ifreund> and is distinct from `[]u8`
<KoljaKube> But if I only have the u8 part?
<afontain_> it's also a type
<KoljaKube> Yeah, sorry, I guess I'm not good at explaining
<ifreund> in that case you're talking about the constness of the variable storing the value
<ifreund> const x: u8 = 42;
<ifreund> the constness is a property of x not of the type it is storing
<KoljaKube> I was thinking about a function like foo(comptime T: type, []T data), is there a way to switch data to []const T depending on T
<KoljaKube> I'm trying to write a wrapper around mutable and immutable buffers and I'm trying to figure out how much of that information I can get into the type system
<ifreund> why not do foo(comptime T: type, data: T) and call like foo([]const u8, data) or foo([]u8, data)
<KoljaKube> I guess I could do that, if there was a way to get a @sizeOf(u8) out of that
<ifreund> i think @typeInfo should give you that
<mq32> yeah, you can use @typeInfo
<KoljaKube> Would that be TypeInfo.Pointer.child? Documentation in builtin.zig is kind of sparse...
<mq32> yeah
<KoljaKube> Thanks :-)
halbeno has joined #zig
dermetfan has quit [Ping timeout: 272 seconds]
<KoljaKube> So if all that would work, is it also possible to conditionally exclude functions from anonymous structs?
<ifreund> not sure I follow
<KoljaKube> What I would want to do is not have an `update()` function if my T above is []const u8
<mq32> yes, it's possible
<mq32> usingnamespace SpecializedFunctionStruct(@This());
<mq32> and you can if the portion in usingnamespace
<KoljaKube> Is there something like that in std or somewhere else I could get a more complete snippet?
waleee-cl has joined #zig
<ifreund> usingnamespace if (@typeInfo(T).Pointer.is_const) FunctionThatRetunsStructWithUpdateFunction(@This());
<ifreund> does that help?
<nerthus> well I fixed my problem
<ifreund> you might need to add an `else struct {}` to the end of that
manuzor has quit [Remote host closed the connection]
<ifreund> could also skip the function and do
<ifreund> usingnamespace if(is_const) struct{ pub fn update() { .. } } else struct {};
<KoljaKube> Ah, that's where the if goes
<KoljaKube> The else is not needed
<KoljaKube> Well, that is awesome
<ifreund> indeed, I love how zig can do so much with such simple rules :)
<KoljaKube> Yeah
alexnask has joined #zig
<KoljaKube> So far zig has definitely one of the nicest compile-time type systems I've head the pleasure to use
<KoljaKube> And a great community, thanks for entertaining my weekendly question-fueled pop-ins here ;-)
<ifreund> no problem!
andrii has joined #zig
andrii has quit [Client Quit]
andrii has joined #zig
dddddd has joined #zig
knebulae has quit [Read error: Connection reset by peer]
knebulae has joined #zig
Snetry has quit [Ping timeout: 260 seconds]
<KoljaKube> Hm, in my actual code I do need the `else struct{}`. Not sure where the difference is
<ifreund> i'd guess it parses without the else struct{} but doesn't compile, and whatever you were testing with wasn't using the update function so it didn't get compiled
<ifreund> would be surprised if it worked without the else struct{} tbh
<KoljaKube> No, definitely did compile with a call to the potentially hidden function
Snetry has joined #zig
<KoljaKube> Actual code (any other hints appreciated): https://gist.github.com/koljakube/58a5026594b72fb0832a18a3aac24502
<KoljaKube> And by other hints I meant non-zigisms or potential for improvement or somesuch
frett27 has joined #zig
<ifreund> KoljaKube: you don't need to do `s: Wrapped = undefined,` it's already undefined if you just do `s: Wrapped,`
<KoljaKube> Ah, that is probably left over from when those were local variables inside a function, thanks
<ifreund> also, it looks like `usingnamespace if (a) struct { fn b() {} };` won't compile if `a` is false
<KoljaKube> That might explain it, since commenting in the last lines of main() errors expectedly anyway, and I might have misread the messages
dermetfan has joined #zig
<alexnask> Zig shotime #3 preshow is live: https://www.twitch.tv/kristoff_it
<greenfork> cool cool
dermetfan has quit [Ping timeout: 256 seconds]
<ifreund> show just started
oats is now known as didymos
marnix has joined #zig
kristoff_it has joined #zig
HollMax has quit [Ping timeout: 245 seconds]
craigo has joined #zig
nerthus has quit [Remote host closed the connection]
nerthus has joined #zig
dermetfan has joined #zig
riba has joined #zig
alexnask has quit [Read error: Connection reset by peer]
alexnask has joined #zig
aerona has joined #zig
marnix has quit [Ping timeout: 258 seconds]
riba has quit [Ping timeout: 264 seconds]
kristoff_it has quit [Ping timeout: 246 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
bgiannan has joined #zig
slowtype1 has joined #zig
slowtyper has quit [Ping timeout: 264 seconds]
cole-h has joined #zig
andrii has quit [Quit: Leaving]
andrii has joined #zig
andrii has left #zig [#zig]
* andrewrk catching up on showtime
<andrewrk> mq32, your microphone sounds really good, would you mind sharing info about it so I can look into possibly getting one too?
<mq32> thanks 🤣
* mq32 is afraid of sharing info :D
<andrewrk> haha
<andrewrk> thanks!
<mq32> it's a callcenter headset :D
<mq32> and yeah, i love the clarity of the sound as well
<andrewrk> mq32, I know you mentioned it but it never quite sank in, I didn't realize you were creating an entire cpu architecture and then building it. your project is mind blowing
<mq32> ♥
<mq32> and: it has a zig-based toolchain!
<andrewrk> :D
<mq32> it's paused right now, because of sme other projects, but i will return
<mq32> doing hardware stuff is sometimes frustrating
<mq32> how's stage 2 going on?
<andrewrk> I'm hoping to reach a stage2 demo point early this week
<andrewrk> Progress feels slow because I'm investing in all the difficult design decisions up front, rather than just cranking through zig language features
<andrewrk> but I'm confident the investment will be worth it
<mq32> yeah, it's just unusually silent
<mq32> but i know that "thinking through"
<mq32> instead of just going full-frontal coding
<andrewrk> I've also taken a few vacation days this week for family stuff
<mq32> good!
<fengb> “Full-frontal coding”... not a phrase I’d use
<companion_cube> nothing to hide between consenting adults
<companion_cube> that's the way of the python
<companion_cube> (or so it says in their zen)
<andrewrk> mq32, not sure if you saw this yet: https://github.com/ziglang/zig/pull/5583
<andrewrk> I have some unpushed code on that branch as well
<andrewrk> I think it will feel like more progress is happening once you can start seeing the tests being added with actual zig source code
<mq32> yeah, true
<andrewrk> poor pixelherodev fell for the troll bait on the twitch chat
<mq32> hm?
<andrewrk> not worth your time pixelherodev :)
<ifreund> i mean they were definitely trying to bait us or something originally, but they seemd to actually consider the responses
<andrewrk> oh, that's an unexpected happy outcome
<companion_cube> maybe the answers should be collected somewhere?
<andrewrk> meanwhile, the actual video is mq32 describing a CPU architecture and an assembler, in which context "memory safety" is nonsensical
<mq32> heh
<companion_cube> true
<andrewrk> that's why I labeled it a troll, it's off topic
<mq32> it appears to me that some rust folks trust their language too much
<mq32> i've seen really impressive rust projects in terms of stability
<mq32> and i've seen stuff that crashes on the first interaction with unplanned behaviour
<mq32> same for any other language though :D
<companion_cube> rust makes it easy to program defensively, though
<mq32> yeah, true
<mq32> luckily, Zig as well :)
<ifreund> it also makes error handling realtively painful in comparison with zig
<companion_cube> a bit less, but still much better than C
<andrewrk> oh wow the idea that every instruction could be a jump instruction is super interesting!
<mq32> it's super-crazy
<mq32> you can do … interesting things with that
<andrewrk> mq32, we gotta have a SPU backend for zig :)
<mq32> told you so!
<alexnask> Why not Risc-V and let Thor handle it? :D
<andrewrk> I haven't gotten that far yet :D
<andrewrk> I was, uh, out pretty late last night for my cousin's birthday. was not in a position to be awake at 7am this morning
riba has joined #zig
<ifreund> oof, yeah didn't realize it was so early in the states
<mq32> andrewrk: if you're interested in the architecture, you can have a nice evening read here: https://ashet.computer/documentation.htm
<andrewrk> bookmarked
<fengb> There’s documentation? What kind of programmer are you
<andrewrk> is the SPU Mark II Instruction Set Architecture stable?
KoljaKube has quit [Quit: WeeChat 2.8]
<andrewrk> looks like it has post-1.0 version numbering
<mq32> it's the document versioning actually :D
<mq32> it's quite stable already, nothing breaking is planned anymore
<ifreund> i guess that's what you get with simplicity
<mq32> except for an improved interrupt handling and two other instructions
<mq32> (cpuid and some kind of "syscall" thingy for soft-cpu control)
<andrewrk> neat! I think it would be a good architecture to support to make sure the design does not overfit for any particular architecture
<mq32> true
<mq32> the SPU ISA is quite different than most else
riba has quit [Ping timeout: 258 seconds]
<mq32> also, it would be absolutely awesome to have a real compiler for that arch
<andrewrk> it can go inside an elf container, yes?
<mq32> i can use objcopy :D
<alexnask> Hmm total ArrayList support (as in resolving T, Slice, etc. for a type returned by ArrayList(T)) is more difficult than I realized
<alexnask> (in zls, that is)
nephele_ has joined #zig
nephele has quit [Ping timeout: 264 seconds]
nephele_ is now known as nephele
<alexnask> Still relatively close, I think I can get it done this week
<ifreund> is the immediate goal primitive types or are you going straight to arbitrary ArrayList(ArrayList(T)) nestings?
<andrewrk> neat, I haven't seen this use case with @"" function names to do parsing
<ifreund> yeah that's a super neat idea right?
doublex has quit [Ping timeout: 264 seconds]
<alexnask> Primitive types are not interesting, they have no fields
<alexnask> :D
reductum has joined #zig
<ifreund> right :D
<alexnask> Type argument parameter already works in type-fns
<alexnask> But ArrayList calls into ArrayListAligned and I dont forward them yet
<alexnask> type argument parameter binding*
tdc has quit [Ping timeout: 264 seconds]
<alexnask> And issue #2 is that Slice/SliceConst depend on the alignment passed, so it requires some knowledge of comptime nullable types + integers
<alexnask> To resolve the if expression correctly
nerthus has quit [Remote host closed the connection]
<andrewrk> "Go with SPU Mark II, it doesn't have spectre, it doesn't have meltdown, it doesn't have cache misses, because there is no cache." this is gold xD
doublex has joined #zig
<andrewrk> the unofficial Q&A during the break is nice
<andrewrk> love those happy bird chirping vibes during pixelherodev's talk
reductum has quit [Ping timeout: 256 seconds]
<pixelherodev> uheh
<alexnask> lol type param forwarding actually works Im stupid
<pixelherodev> propsoal:
<pixelherodev> release mode with inlin8ng disabled
<pixelherodev> This is useful for profiling
<pixelherodev> s/8/i
<andrewrk> profiling is an important use case. don't you want to run your profile tests taking into account inlined functions though?
<pixelherodev> yes, but it's also nice being able to see how the function affect - hey wait, kcachegrind shows impact of indivisual lines
<pixelherodev> sweet
<pixelherodev> s/sual/dual
<pixelherodev> never mind then :)
<mq32> <andrewrk> neat, I haven't seen this use case with @"" function names to do parsing
<mq32> i don't know, it appeared natural to me to do this
<mq32> if i can @"" everything, why keep tables to translate it?
<andrewrk> oh I agree with you, I just hadn't thought of it, and hadn't seen anyone else do it yet
<mq32> my args parser is doing it as well
<pixelherodev> ?
<pixelherodev> which bit is this?
<mq32> i assume andrew is referring to my handling of mnemonics
doublex has quit [Ping timeout: 260 seconds]
waleee-cl has joined #zig
<andrewrk> wow pixelherodev this is really ambitious. and your pace of development is impressive!
<andrewrk> the package manager use case is interesting, I like that it solves the problem that most applications do not take advantage of -march=native
<mq32> make zig compile so fast that we don't need precompiled packages!
doublex has joined #zig
<pixelherodev> Working on jmproving rawmcodeg3n next
<pixelherodev> Tehn some basic optimizations, possibly
<pixelherodev> gah
<pixelherodev> improving raw codegen next, then possibly some basic optimizations*
<pixelherodev> stage2 error tests first though
<andrewrk> pixelherodev, this testing infrastructure that you've pioneered is soon going to become something we need in zig for testing multiple backends. you've written a bunch of useful tools
<andrewrk> I'm really impressed
<andrewrk> it's so cool that mq32 just demoed his own cpu architecture and then pixelherodev comes along, "btw and I've written a JIT for it"
<mq32> :)
<pixelherodev> heh, yeah :)
<pixelherodev> as I've said repeatedly
<pixelherodev> the single nicest architecture I've worked with, emulation wise
<pixelherodev> bar none
<pixelherodev> LIMN comes close, but not quite
<mq32> thanks
<mq32> it's also nice to code in assembler
<mq32> i should patch up the emulator and make it up-to-date with the current HW version
<pixelherodev> uhoh
<pixelherodev> :p
<mq32> that means: MMU, more RAM, more ROM and more devices
<mq32> for example: video!
<pixelherodev> wait
<pixelherodev> more ROM?
<pixelherodev> fuuuuu
<pixelherodev> wait no it's fine
<pixelherodev> cache supports the full address space
<pixelherodev> not just ROM
<pixelherodev> oh yeah
doublex has quit [Ping timeout: 265 seconds]
<pixelherodev> reworked the cache ;)
<pixelherodev> it's now more than twice as fast in debug mode
<mq32> debug mode doesn't coun
<mq32> *count for perf
<pixelherodev> it matters
doublex has joined #zig
<pixelherodev> it was a deliberate goal
<pixelherodev> it means a reduced incentive to skip tests
<pixelherodev> release mode is onlyn10% faster ish so far
<pixelherodev> probably a bigger improvement on older microarchs
ur5us has joined #zig
didymos is now known as oats
<andrewrk> I like the construction sounds in the background of pixelherodev's Q&A, they are inspiring and metaphoric
<andrewrk> that was an excellent showtime episode
<ifreund> yeah tons of super cool low level stuff
<pixelherodev> Ha
<pixelherodev> andrewrk: TBH, I didn't hear the sounds :P
<pixelherodev> Or perhaps I just didn't notice them
<mq32> your godray effect was nice as well
<pixelherodev> ?
* pixelherodev ducks
<pixelherodev> Ahh
<pixelherodev> Gotcha
<mq32> 01:30:50
<pixelherodev> mq32: I take back what I said
<pixelherodev> It's more than twice as fast in release mode too
<pixelherodev> ;)
<pixelherodev> At ~2:03:35 I said "improving cache behavior would probably get runtime below 400ms"
<pixelherodev> I believe I have been proven correct :)
<pixelherodev> `401ms` okay close enough lol
<mq32> i just skipped through my talk, checking overall quality
<mq32> and i'm really happy about audio quality as well
<ifreund> yeah I think I might need to pick up one of those callcenter headsets if/when I give another talk
<ifreund> need to write more code first though
<mq32> yeah the audio quality is superb :D
<mq32> 30€ is also a really acceptable price
<mq32> and it's light, not the heavy gamer headset
doublex has quit [Ping timeout: 246 seconds]
doublex has joined #zig
doublex has quit [Read error: Connection reset by peer]
doublex has joined #zig
<pixelherodev> I wish there was a way to use -O1 with Zig :(
<pixelherodev> debug mode builds in ~ten seconds, release-fast requires multiple minutes
<pixelherodev> I just want basic optimizations, I don't need full -O2 :(
doublex has quit [Read error: Connection reset by peer]
doublex_ has joined #zig
st4ll1 has quit [Ping timeout: 256 seconds]
_Vi has quit [Ping timeout: 272 seconds]
st4ll1 has joined #zig
dermetfan has quit [Ping timeout: 256 seconds]
frett27 has quit [Ping timeout: 256 seconds]
FireFox317 has quit [Ping timeout: 256 seconds]
st4ll1 has quit [Ping timeout: 256 seconds]
st4ll1 has joined #zig
doublex_ has quit [Ping timeout: 264 seconds]
st4ll1 has quit [Ping timeout: 256 seconds]
st4ll1 has joined #zig
doublex has joined #zig