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/
<stripedpajamas> is there an idiomatic way to pass []const u8 into functions that accept []u8 ?
<pixelherodev> Don't?
<pixelherodev> More seirously, what's the context?
<pixelherodev> s/seiro/serio
<pixelherodev> There's definitely no idiomatic way, because that's not supposed to happen
<pixelherodev> Where is the string coming from? What's the function doing with it?
<stripedpajamas> hmm sorry, still exploring the language. i wrote a func that operates on []u8 and in my test i was using a string literal as input, which doesn't work ofc. instead i tried passing a manually created [_]u8{a, b, c,...} to it, but it complains that the function expects []u8 and not [11]u8
<pixelherodev> Yeah, `[_]u8` != `[]u8`
<pixelherodev> `[_]u8` means "an array of u8s with the ssize inferred by the compiler"
<pixelherodev> s/ssize/size
<pixelherodev> `[]u8` is a *slice* of u8s
<pixelherodev> `&[_]u8` gives a slice though
<pixelherodev> IIRC
<fengb> Technically it gets an array pointer which coerces into a slice
<pixelherodev> ^
<stripedpajamas> ok i am still a little confused. if i have a func that accepts only []u8, how would i go about testing it?
<stripedpajamas> the couple of combinations of input data i've tried to make are all rejected due to type expectations
<pixelherodev> What you can do is allocate a mutable copy, and pass that in
<pixelherodev> See `std.mem.dupe`
<pixelherodev> e.g. `std.mem.dupe(allocator, u8, "literal");` gives a `![]u8`
<stripedpajamas> i see i see
<fengb> I’d recommend switching to `[]cost u8` if you aren’t mutating it
<pixelherodev> DOn't forget to free it though :)
<pixelherodev> ^ that too
<fengb> Const
<daurnimator> stripedpajamas: e.g. `var foo: [50]u8 = undefined; yourfunc(&foo)`
<stripedpajamas> i was thinking []const u8 would signal (to humans) that a string is expected. is it more correct to say that []const u8 simply signals an immutable byte array ?
<pixelherodev> Yes
<stripedpajamas> got it
<pixelherodev> That typically represents a string, yes, but an *immutable* string
<stripedpajamas> ok
<pixelherodev> []u8 is similarly used to represent *mutable* strings
<fengb> Or just bytes. We don’t have real strings yet
<pixelherodev> I mean
<pixelherodev> Bytestrings are strings
<pixelherodev> It's a bunch of *bytes*...
<pixelherodev> *strung* together
<fengb> Most things are UTF8 or ascii by convention but nothing is guaranteed yet
<pixelherodev> True
<oats> Any chance that zig fmt could clean up unused top-level non-pub consts? :)
<pixelherodev> Proposal: make UTF-8 the default :P
<oats> anything like that been brought up before?
<pixelherodev> I mean, maybe, but people probably wouldn't want that
cole-h has quit [Quit: Goodbye]
<pixelherodev> What I'm thinking is we should have a separate utility
<pixelherodev> `zig lint`
<pixelherodev> Instead of formatting, it finds things like that, and lets the user decide what to do with them
<pixelherodev> e.g. `zig lint --cleanup-unused-consts`
<oats> mm, that'd be nice
<pixelherodev> With the explicit understanding that the linter is only intended to provide advice to humans
<fengb> There’s a few discussions for UTF8. Most of the ideas leans towards a userland type
<pixelherodev> and should never be used as the be-all and end-all source
<pixelherodev> I support that
<pixelherodev> That's not a bad idea
cole-h has joined #zig
<fengb> A lot of low level stuff tends to do better with bytes without encoding
<fengb> e.g. we can do Unicode formatting already even though the stdlib is wholly unaware
<fengb> Of course... then somebody wants to uppercase things and things break >_>
<pixelherodev> True...
<andrewrk> upper casing things considered harmful
<pixelherodev> Considered harmful essays considered harmful
<stripedpajamas> oh its all making sense now. since []u8 coerces to []const u8 the function is usable with []u8 and []const u8. whereas how i had it before, only accepting []u8, it was a pain to test
<pixelherodev> :)
<fengb> Yep, const is generally easier to work with in general
<fengb> Generally general. I’m a pro at English
aerona has joined #zig
<pixelherodev> :)
cole-h__ has joined #zig
cole-h has quit [Ping timeout: 256 seconds]
mattmurr has joined #zig
stripedpajamas has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cole-h__ has quit [Quit: Goodbye]
cole-h has joined #zig
dimenus has joined #zig
[rg] has joined #zig
CommunistWolf has joined #zig
<andrewrk> my changes to the self-hosted parser in this branch today:
<andrewrk> throughput: 45.6 MiB/s => 55.6 MiB/s
<andrewrk> maxrss: 359 KB => 342 KB
<andrewrk> I wonder what a realistic target throughput value is, how this is to the theoretical max. I'm sure there is still a lot of room for improvement
cole-h__ has joined #zig
cole-h has quit [Ping timeout: 256 seconds]
ur5us has quit [Ping timeout: 244 seconds]
<fengb> Wow, is that constant memory for the parser?
<andrewrk> this is using the gotta-go-fast benchmark. maxrss measures the peak resident memory, which means the maximum of how much the process ever used. that benchmark iterates over the entire std lib and parses every file
<andrewrk> ok I tried making TokenIndex u32 instead of usize, and somehow it results in worse throughput *and* more memory used somehow
<andrewrk> riddle me this batman
nephele_ has joined #zig
nephele_ is now known as nephele
marijnfs_ has joined #zig
<oats> are there equivalents to std.math.{add,sub,mul} for floating point types?
<pixelherodev> andrewrk: on a 64-bit target?
<pixelherodev> Could be that LLVM isn't promoting to 64-bit
<pixelherodev> and 64-bit ops can be faster than 32-bit
<andrewrk> pixelherodev, ya
cole-h__ has quit [Quit: Goodbye]
cole-h has joined #zig
<foobles> YES!!!! FINALLY TESTS PASSING!
<andrewrk> woot woot
<foobles> :D
<foobles> ill submit a new pr soonish i just want to clean it up a little
<andrewrk> wonderful
ur5us has joined #zig
<foobles> thanks :) on my last PR, you mentioned adding tests for ?*T == *T
<foobles> but that already is in the language, so should I put that in a seperate test?
<foobles> since that logic is fundamentally different for non-pointer optionals
<andrewrk> no, my mistake, if it was already tested, no problem
<[rg]> didn't meet the requirements for mlh, where should new folks start browsing the code base?
<dimenus> [rg]: what do you want to do?
<[rg]> parser stuff, os stuff, anything really
<[rg]> interested in parsing though, most experience there
<[rg]> or learning more about assembly :-)
<pixelherodev> Assembly's always fun :)
<pixelherodev> I haven't heard back yet, so I'm still hopeful
<GreaseMonkey> except for when your codebase is large, then it's kinda horrid
<dimenus> if you're going to learn assembly, i'd recommend aarch64 or risc-v, going to need a debug backend for other targets :)
<pixelherodev> Uh
<pixelherodev> ixnay on the aarch64
<pixelherodev> I'm going to be tackling that in the morning :)
<pixelherodev> Unless you want to, in which case I can work on something else instead?
<[rg]> no go ahead
<[rg]> risc-v is intersting too
<pixelherodev> Cool, thanks :)
<[rg]> syscall stuff is all done?
<pixelherodev> Which syscall stuff?
<pixelherodev> You mean in the standard library?
<[rg]> yeah
<pixelherodev> fPretty sure it is
<pixelherodev> There might be bits and pieces here and there though
<[rg]> I mean zig has too since it competes with c right
<pixelherodev> It definitely has syscalls in place
<pixelherodev> e.g. std.os.write uses the write syscall
<[rg]> does zig use a posix emulator for windows?
<dimenus> [rg]: it uses mingw if you target gnu but otherwise no
<[rg]> ok, thanks for anwering my questions
stripedpajamas has joined #zig
<dimenus> at one point i contributed some code to use COM to find the MSVC CRT/SDK but i'm not sure if it's still being used
<dimenus> MSVC tends to make drastic changes
<dimenus> i'm now on linux full time (including
<dimenus> **including work
<pixelherodev> Nice :)
<dimenus> pixelherodev: it's been positive overall, i did buy a hidpi monitor recently though and that's been more challenging
<dimenus> sway/wayland is almost there but X11 is a mess
<dimenus> where as windows works just fine with mixed dpi
<pixelherodev> Sway = <3
[rg] has quit [Quit: Konversation terminated!]
<pixelherodev> ... I'm about to send a 1-line PR>
<pixelherodev> It only changes comments
<pixelherodev> CI is still going to run
<pixelherodev> :P
waleee-cl has quit [Quit: Connection closed for inactivity]
<dimenus> you should apologize to andrewrk :)
cole-h has quit [Quit: Goodbye]
cole-h has joined #zig
<companion_cube> git push -o skipci? :p
wozeparrot has quit [Ping timeout: 260 seconds]
layneson has quit [Quit: WeeChat 2.8]
B4s1l3 is now known as opDispatch
<pixelherodev> I don't think that exists
<pixelherodev> It's github, not git
slice has quit [Quit: zzz]
xackus has joined #zig
<companion_cube> ah thought it was sr.ht
<pixelherodev> lol :P
<pixelherodev> I don't think ziglang is actually on there for much beyond CI
<pixelherodev> Ahhh wait, sr.ht accepts an option like that?
* pixelherodev shrugs
mq32 has joined #zig
opDispatch has quit [Quit: Konversation terminated!]
cole-h has quit [Quit: Goodbye]
cole-h has joined #zig
dimenus has quit [Ping timeout: 265 seconds]
cole-h has quit [Quit: Goodbye]
cole-h has joined #zig
mq32 has quit [Ping timeout: 260 seconds]
mq32 has joined #zig
mikdusan has joined #zig
slice has joined #zig
slurpie has joined #zig
<scientes> andrewrk, I created a perfect hash that 3X the tokenizer speed
<andrewrk> cool
<scientes> or rather, a perfect bisection generator
<scientes> with interpreter
<scientes> the idea is to allow switch on [:0]u8
mq32 has quit [Ping timeout: 272 seconds]
<scientes> I wasn't going to mention it, but i see you are working on speeding up the parser
cole-h has quit [Quit: Goodbye]
mq32 has joined #zig
cole-h has joined #zig
<fengb> Would an O(1) jump table help? Swhash is designed for this usecase: https://github.com/fengb/fundude/blob/master/src/Cpu/Op.zig#L494
<fengb> Max length of 16 >_>
<scientes> where is the code?
<scientes> oh i see, its a hash
<fengb> It's a perfect hash
<scientes> yeah, this is a perfect bisection
<scientes> so actually not a hash
<scientes> which avoid degenerative cases that gperf suffers from
<fengb> This has almost no logic for hashing
<fengb> Just relies on letters = bytes up to u128
<fengb> No cache because there's nothing to do other than a memcpy
aerona has quit [Quit: Leaving]
<scientes> it also isn't flexible
<fengb> It's flexible... up to 16 chars
<scientes> I support all [:0]u8 (which no embedded nulls)
<scientes> and it is guaranteed to run in O(log n) time, with O(n log n) construction
<scientes> and O(n) space
<scientes> the only issue is that it is a big ram-heavy (4KB interpreter), so it needs to be a hot code path to be worth the cache
<scientes> oh, and it needs @popCount() hardware support
<scientes> fengb, llvm has a O(1) jump table, you just have to switch on a dense set of case statements
mq32 has quit [Ping timeout: 256 seconds]
mq32 has joined #zig
<scientes> what you are doing does not generate a dense switch, so it isn't O(1) jump table, as llvm can't really generate sparse jump tables
return0e[m] has joined #zig
fengb has joined #zig
foobles has quit [Ping timeout: 245 seconds]
mq32 has quit [Ping timeout: 258 seconds]
mq32 has joined #zig
dermetfan has joined #zig
stripedpajamas has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mq32 has quit [Ping timeout: 260 seconds]
slice has quit [Quit: zzz]
ur5us has quit [Ping timeout: 260 seconds]
mq32 has joined #zig
stripedpajamas has joined #zig
slice has joined #zig
_whitelogger has joined #zig
mq32 has quit [Ping timeout: 265 seconds]
mq32 has joined #zig
mq32 has quit [Ping timeout: 240 seconds]
mq32 has joined #zig
GoorMoon has joined #zig
xackus has quit [Ping timeout: 256 seconds]
mq32 has quit [Ping timeout: 256 seconds]
stripedpajamas has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mq32 has joined #zig
mq32 has quit [Ping timeout: 260 seconds]
greenfork has joined #zig
ifreund has joined #zig
cole-h has quit [Quit: Goodbye]
<GreaseMonkey> well, i finally cleaned up that copy-paste in my deflate decompressor
cole-h_ has quit [Quit: Goodbye]
mq32 has joined #zig
mq32 has quit [Ping timeout: 246 seconds]
mq32 has joined #zig
slice has quit [Quit: zzz]
mq32 has quit [Ping timeout: 256 seconds]
wootehfoot has joined #zig
copy has quit [Ping timeout: 256 seconds]
mq32 has joined #zig
slurpie has quit [Ping timeout: 265 seconds]
<alehander92> so basically you can use this inside a tokenizer?
<alehander92> i might try this for my tokenizer
<scientes> alehander92, well, the idea would be to allow [:0]u8 in switch statements
alexnask has joined #zig
<alehander92> ah i see, that's completely different than what i thought
<scientes> that is an overview of how it works
<alexnask> Hello
<scientes> it maps strings to a enum, and then constructs a jump table with that
<scientes> but I am having difficulty building zig
<alexnask> Are you hitting LLVM linking issues?
<alehander92> ah, yeah so you infer them from the case branches?
<scientes> no problem with 0.6.0, but master I get /usr/bin/ld: /usr/lib/llvm-10/lib/libclangCodeGen.a(BackendUtil.cpp.o): en la función `(anonymous namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >)':
<scientes> (.text._ZN12_GLOBAL__N_118EmitAssemblyHelper30EmitAssemblyWithNewPassManagerEN5clang13BackendActionESt10unique_ptrIN4llvm17raw_pwrite_streamESt14default_deleteIS5_EE+0x1f15): referencia a `getPollyPluginInfo()' sin definir
<scientes> alexnask, yeah
<alehander92> i feel i read about similar zig thing in the past, perfect hashing?
eleanor-nb has joined #zig
<scientes> alehander92, no, it constructs multi-way bisect on individual characters, but it isn't a hash, its actually a bisect that serves all the use cases of a hash, but with guaranteed performance characteristics that makes it usable in a compiler
eleanor-nb has quit [Remote host closed the connection]
mq32 is now known as ikskuh
ur5us has joined #zig
_Vi has joined #zig
ur5us has quit [Ping timeout: 260 seconds]
stripedpajamas has joined #zig
cren has joined #zig
<cren> is an ArrayList a type? If so, what type is it?
<ikskuh> ArrayList itself is a function
<ikskuh> that returns a type based on a type
<ikskuh> so
<ikskuh> ArrayList(u8) is an expression that calls ArrayList with u8, returning a struct type
<ikskuh> that implements an array list
<cren> right
<cren> so how do I refer to that type in my program
<ikskuh> ArrayList(u8)
<ikskuh> or, if you want a function that takes a generic array list
<dermetfan> that's evaluated at compile time so no overhead as you might think
<ikskuh> fn foo(comptime T: type, list: std.ArrayList(T)) void
<cren> ok
stripedpajamas has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<cren> Can I use index notation `arr[i]` on an ArrayList?
<dermetfan> arr.items[i]
<cren> that makes more sense, thanks
<cren> How should I concatenate two ArrayLists?
<ikskuh> .appendSlice
<cren> I thought so. Does .items return a slice?
<ikskuh> yes
<ikskuh> it returns the current slice of elements
<alexnask> and toOwnedSlice() shrinks the memory, returns items and clears the ArrayList so you probably want to arr1.appendSlice(arr2.toOwnedSlice())
<alexnask> (not exactly that but you get the idea)
<cren> ah but I don't want to just concatenate them and destroy their existence as separate lists. I want to pass `correctLetters` and `missedLetters` to a function which takes one argument, `guessedLetters`, but still have separate `missedLetters` and `correctLetters` in `main`
<alexnask> Right, appending items is the way to go then :-)
dimenus has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
cren has quit [Ping timeout: 245 seconds]
wootehfoot has joined #zig
dermetfan has quit [Quit: WeeChat 2.7.1]
cren has joined #zig
[rg] has joined #zig
mmx870 has quit [Quit: Ping timeout (120 seconds)]
mmx870 has joined #zig
dimenus has quit [Quit: WeeChat 2.8]
puzzleddev has joined #zig
wootehfoot has quit [Ping timeout: 265 seconds]
greenfork has quit [Ping timeout: 272 seconds]
<pixelherodev> Is it just me or has this channel been less active lately?
<ifreund> perhaps a bit, i haven't noticed any massive change though
<ikskuh> i noticed that too
<ikskuh> people are more concernd writing fancy stuff than doing noisy chatter :D
<pixelherodev> That's always good :)
<fengb> `concernd` looks like a daemon
<ikskuh> systemctl stop concernd
<pixelherodev> boo
<pixelherodev> `rc-service concernd stop`
<pixelherodev> ^ that's how it's done
<ikskuh> killall concernd
* pixelherodev casually backs out
wootehfoot has joined #zig
Akuli has joined #zig
<ifreund> i think you meant `sv down concernd` :P
<nephele> it's obviously rm /service/concernd; s6-svscanctl -an /service ;)
edr has quit [Ping timeout: 256 seconds]
<alehander92> scientes awesome, ill think abou tit
<alehander92> eventually
edr has joined #zig
<pixelherodev> nephele: I'd say "I have to try s6," but I really couldn't less about freaking PID1
<pixelherodev> OpenRC is good, my system works fine
<pixelherodev> Why worry about it?
<nephele> and s6 works fine too :), i don't use it as process 1, although i probably could
<pixelherodev> ahh, it runs *over* something else?
<nephele> not sure i understand your question
<nephele> it's a supervisor, how you setup your system is your choice
<pixelherodev> Gotcha
<cren> I have heard that s6 is good but I have not heard of any distro that uses it
<ikskuh> andrewrk: about #1717 and the function pointers: I think it would be possible to have function values at compiletime
dimenus has joined #zig
<ikskuh> which can then be exported
<ikskuh> this would require function pointers to be explicit instead of how they're done atm
jhamren has quit [Quit: leaving]
<ifreund> cren: well obarun and artix do, but neither is very large/well maintaned yet
<ifreund> anyhow, this is off topic
slice has joined #zig
dddddd has joined #zig
<pixelherodev> Is anything off topic?
<pixelherodev> It's all tangentially connected :)
<fengb> Rules say "No discussion of things that are both controversial and off-topic."
<fengb> So you're fine :P
<ikskuh> but systemd is controversial!
<companion_cube> is it though? it's accepted in almost every distro
<companion_cube> :P
<Akuli> :D
<pixelherodev> That doesn't define controversy
<ifreund> ^
<pixelherodev> You know what else is accepted in every distro?
[rg] has quit [Ping timeout: 256 seconds]
<pixelherodev> people
<pixelherodev> Those are *very* controversial
<pixelherodev> AIs for all
<pixelherodev> Down with the humanity!
<pixelherodev> /s
<pixelherodev> Well
<pixelherodev> Half /s
<pixelherodev> /?
<ifreund> 0.5/
<BaroqueLarouche> I, for one, welcome our AI overloads
<nephele> But do they welcome you?
cole-h has joined #zig
[rg] has joined #zig
<ifreund> of course, we are their batteries
* ikskuh plugs ifreund into his laptop to charge it
<companion_cube> such a ridiculous part of that film :D
<fengb> Apparently they wanted to use people as neural networks but producers nixed that idea
<fengb> It also explains super powers a lot better
<fengb> "Rules can be broken" like what is this crap. The sysadmin would patch that out immediately
<pixelherodev> ... see that would actually be kinda interesting
<pixelherodev> also yay bikeshedding
<fengb> Hmm... The Matrix is basically proto-Lucy 🤔
<fengb> It really wouldn't change most of the movie but the plot holes are a lot more limited. So hopefully it improved your enjoyment :P
<afontain_> "meat brain", "human computing modules", I'm sure we can come up with creative names!
<afontain_> "Oh yeah, I trained a pair of neural nets, Emily and Kevin, to respond to support tickets."
<fengb> I think it was more of borrowing brain power for computing. So people actually do use only 10% of their brains
<fengb> So... Lucy
<gonz_> People can't patch out bugs for shit
<pixelherodev> lol that's not true
<pixelherodev> *Some* people can't
<pixelherodev> Actual skilled engineers can
<pixelherodev> It *should* be a mandatory skill
<companion_cube> some bugs are harder than others, though
<fengb> I'm not talking about people. MACHINES
<gonz_> If you hadn't noticed pretty much every machine/program in The Matrix is the very opposite of infallible
<fengb> But they don't fix anything ever
<gonz_> They've gone through 5 iterations of attempting to fix their biggest bug.
<companion_cube> and are still vulnerable to EMP
<gonz_> pixelherodev: That's a "no true scotsman" if I ever saw one.
<gonz_> "No true engineer would be unable to fix bugs!" :D
<pixelherodev> No, I mean that it's an actual skill and requires practice
<pixelherodev> It's not "no true engineer!!!"
<pixelherodev> It's, "any engineer can *learn* to if they put their minds to it"
<pixelherodev> It's a disparate skill from programming, but still connected and very important
<pixelherodev> Learning to debug is like learning to use Git: it's annoying initially, it has a notable time investment, but the payoff is frankly massive
<pixelherodev> and *every programmer should do it*
<companion_cube> depends on tools, too
<companion_cube> using gdb is quite different from debugging with printf
<gonz_> This presupposes that the main thing preventing people from fixing bugs is their own knowledge.
<gonz_> Just like initial code quality these aren't things that are actually inhibited mainly by engineer knowledge.
<gonz_> Not in the majority of cases, at least.
<gonz_> Give someone enough time and they can do anything.
<pixelherodev> I think that in the vast majority of cases, GDB + Valgrind tools are more than sufficient
<gonz_> Give them the hustle and bustle of modern development and they'll do a crap job.
<pixelherodev> and I sincerely hope you don't think the GitLab solution is a good one :P
<companion_cube> pixelherodev: if you use a language where these make sense
<pixelherodev> companion_cube: true
<pixelherodev> but if you're deliberately choosing a language that you know you don't know how to debug...
<pixelherodev> gonz_: the GitLab solution to bugs is "have the process periodically commit suicide and replace itself with a new copy"
<pixelherodev> I think their site puts the average lifetime of a GitLab worker at four freaking seconds
<companion_cube> I've been debugging with printf for years, it's just another skill
<gonz_> pixelherodev: This seems like it should have limited usefulness. I'm all for the erlang model in some cases but that would have the nuance that you let things die if they catastrophically fail, not necessarily have the commit suicide because you can't fix them stalling.
<ikskuh> printf-debugging is imho one of the easiest and fastest ways of debugging
<ikskuh> it's also working on nearly all platforms you can use
<gonz_> But I'm not familiar with what you're talking about, so
<fengb> pixelherodev: that's just the Ruby way :P
<pixelherodev> The entire point is that GitLab is apparently full of memory leaks all over the place
<pixelherodev> and instead of fixing the leaks...
* pixelherodev is disgusted
<pixelherodev> ikskuh: agreed :)
<pixelherodev> But
<pixelherodev> If you have a text channel, you can run a GDB stub :)
<ikskuh> reading code + printing f
<fengb> F
<ikskuh> gdb won't help you with larger data sets
<pixelherodev> Why not?
<pixelherodev> (genuine curiousity; haven't been in such a situation)
<ikskuh> having a bug that happens after 1.5 Mio steps?
* pixelherodev winces
<ikskuh> you don#t want to singlestep
<pixelherodev> ... yeah but you don't have to
<pixelherodev> GDB is scriptable
<ikskuh> you don't even want to do conditional breakpoints
<pixelherodev> You can tell it "run until X"
<pixelherodev> Ahh, overhead
<ikskuh> yes, indeed
<pixelherodev> You could tell it "run exactly X times"
<gonz_> pixelherodev: I agree, I guess, this clearly isn't the way to (not) solve the issue.
<ikskuh> doesn't help when you don't know the index :D
<ikskuh> then printf helps :D
<pixelherodev> True
<ikskuh> and then you already have your answer :D
<ikskuh> you cannot debug raytracers with breakpoints
<ikskuh> except for like, the trivial cases
<pixelherodev> Ahh, 'cause it's on the GPU?
<ikskuh> nah
<ikskuh> because you have 16_128_000 steps done
<pixelherodev> Anywho, I'mma get started on self-hosting ARM feature detection
<ikskuh> with MSAA of 8
<pixelherodev> ikskuh: ohhh ouch
<ikskuh> \o/
<pixelherodev> good point
<pixelherodev> printf debugging is still debugging :)
<ikskuh> yep
<pixelherodev> but it's also a skill
<ikskuh> kids, don't let someone else tell otherwise!
<ikskuh> code reading is as well
<pixelherodev> You need to know what to print and what's not worth it, where to print it...
<pixelherodev> "Programming" isn't really a skill in and of itself
<pixelherodev> it's a collection of disparate skills
<ikskuh> yeah, true
stripedpajamas has joined #zig
<gonz_> I've been really enjoying how somehow the version of Zig I'm using on Windows seems to have all symbols defined properly, etc., lately. I'm definitely a fan of step-wise debugging, etc., but printf still comes very much in handy.
<gonz_> For the last 5 or so years I haven't really used languages where step-wise debugging made much sense, though, so I wasn't too into it.
<gonz_> And I guess before that I used languages that plain didn't have proper tooling or I didn't have access to it.
<fengb> Speaking of which... I need to enable printf in my emulator >_>
<ikskuh> pixelherodev: the discussion about function stuff on Discord inspired me: https://github.com/ziglang/zig/issues/5385
<pixelherodev> andrewrk: does self-hosted ARM feature detection need to care about running on Windows?
<pixelherodev> I don't think LLVM does :P
<ikskuh> afaik we support windows-on-arm in theory
<pixelherodev> Yes, but I'm fairly sure LLVM doesn't support it :P
<pixelherodev> as a host I mean
<pixelherodev> llvm/lib/Support/Host.cpp only has an impl for Linux
<pixelherodev> `grep -r` shows no other implementations hidden elsewhere
<pixelherodev> ikskuh: interesting
<pixelherodev> I like that proposal :)
<ikskuh> it's one thing that bugged me when coding my embedded demo with C++
<ikskuh> you get all those fancy optimizations
<ikskuh> but collapsing two arrays into each other is not allowed
<ikskuh> because they have a different name
<pixelherodev> And if you really need minimal binary size, you can have an aggressive pass that looks for anywhere in the binary that happens to match the symbol's value
<pixelherodev> e.g. if const data matches machine code by random chance :P
<pixelherodev> I'm only going to add Linux support initially
<pixelherodev> Someone else can add Windows support later if they want
<ikskuh> <pixelherodev> e.g. if const data matches machine code by random chance :P
<ikskuh> exactly!
<gonz_> Do any core/regular contributors use Windows?
<pixelherodev> What's needed in order to build a static Zig binary?
<pixelherodev> I'm considered updating my PC's zig updater to generate a static binary for my laptop :P
<ikskuh> gonz_: afaik yes
<pixelherodev> Does it require a custom static LLVM
<pixelherodev> ?
<ikskuh> err, good question
<ikskuh> look at ziglang/bootstrap for that probably
<ikskuh> afaik zig is by-default statically linked
<pixelherodev> It's not :(
<ikskuh> [felix@denkplatte-v2 zig-current]$ ldd zig
<ikskuh> statically linked
<pixelherodev> `ldd /usr/local/bi/zig`
<pixelherodev> many many deps
<ikskuh> the thing from the website is statically linked
<pixelherodev> Yes but that's not what I'm using :(
<pixelherodev> I build locally
<ikskuh> hm
<pixelherodev> because I have a few small patches on top of it
satchmo has joined #zig
<pixelherodev> That aren't fit to eveer be upstreamed :P
xackus has joined #zig
greenfork has joined #zig
<oats> are there vesions of std.math.{add,sub,mul} that work with floating point types?
<oats> s/vesions/versions
satchmo has quit [Quit: WeeChat 2.8]
satchmo has joined #zig
satchmo has quit [Client Quit]
satchmo has joined #zig
moo has joined #zig
wootehfoot has quit [Ping timeout: 265 seconds]
[rg] has quit [Quit: Konversation terminated!]
satchmo has quit [Ping timeout: 272 seconds]
<cren> Is it a bad idea to make multiple calls to `warn` because I don't want to have a really long line containing all the message? (I'm using `warn` for the main output of my program)
satchmo has joined #zig
waleee-cl has joined #zig
<scientes> oats, just use + - *, there is no concept of "overflow" in IEEE 754 floating point
<fengb> You can add new lines or use multi strings
<oats> scientes: ok, I'll just roll my own that 'return a + b;' then :)
<fengb> Multi line strings
<cren> fengb: I mean a long line in the code, I know about newlines
<fengb> It’ll eventually overflow into infinity though 🙃
moo has quit [Ping timeout: 256 seconds]
oats has quit [Quit: until later, my friends]
oats has joined #zig
<andrewrk> pixelherodev, yes
<andrewrk> but you don't have to implement it for non-windows native ARM cpu feature detection to be merged
cren has quit [Remote host closed the connection]
wozeparrot has joined #zig
slice has quit [Quit: cya]
[rg] has joined #zig
satchmo has quit [Ping timeout: 252 seconds]
GoorMoon has left #zig [#zig]
GoorMoon has joined #zig
GoorMoon has quit [Remote host closed the connection]
GoorMoon has joined #zig
* GoorMoon
pmwhite1 has joined #zig
pmwhite1 has left #zig [#zig]
satchmo has joined #zig
dermetfan has joined #zig
GoorMoon has quit [Quit: ERC (IRC client for Emacs 26.3)]
[rg] has quit [Quit: Konversation terminated!]
FireFox317 has joined #zig
FireFox317 has quit [Quit: Leaving]
neceve has joined #zig
r4pr0n has joined #zig
SimonNa has quit [Remote host closed the connection]
<dimenus> do you guys typically use raw gdb or a frontend?
<andrewrk> I use raw gdb but it's pretty annoying. would love a good frontend
oats has quit [Quit: until later, my friends]
foobles has joined #zig
stripedpajamas has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
edr has quit [Ping timeout: 256 seconds]
edr has joined #zig
layneson has joined #zig
belgin has joined #zig
[rg] has joined #zig
stripedpajamas has joined #zig
oats has joined #zig
<foobles> andrewrk what is the difference between c_allocator.allocate and c_allocator.allocate_nonzero?
<andrewrk> oh, in stage1
<andrewrk> whether it calls malloc or calloc I'm guessing
<foobles> hmm ok
<foobles> thanks
<foobles> i am immediately overwriting what's there, so i guess ill stick to nonzero
layneson has quit [Ping timeout: 252 seconds]
<andrewrk> yep that's the intention. don't worry about it too much; when in doubt use allocate as default. it won't make that much of a perf difference
<alehander92> hm
<alehander92> do you have pretty printers
<foobles> alehander92 for what?
oats has quit [Quit: until later, my friends]
layneson has joined #zig
oats has joined #zig
[rg] has quit [Read error: No route to host]
[rg] has joined #zig
dimenus has quit [Quit: WeeChat 2.8]
satchmo has quit [Ping timeout: 260 seconds]
satchmo has joined #zig
[rg] has quit [Quit: Konversation terminated!]
[rg] has joined #zig
joey152 has joined #zig
dimenus has joined #zig
<xackus> I made a pretty printer for ZigList
<xackus> I wonder if anyone used it yet
<xackus> I should probably mention it in contributing.md
<xackus> alehander92
<xackus> it's in tools/zig-gdb.py
salotz has joined #zig
stripedpajamas has joined #zig
slurpie has joined #zig
SimonNa has joined #zig
ur5us has joined #zig
dimenus has quit [Read error: Connection reset by peer]
<stripedpajamas> any idiomatic way to define a comptime set of key/values ? i see some hashmaps in std, but as far as i can tell they'd have to be runtime-ish. is the recommendation to hack together something with comptime arrays/slices?
<fengb> There’s a pr for comptime hashmaps
<stripedpajamas> oh nice :D
edr has joined #zig
<ikskuh> do you want to built it at comptime or just access it?
<ikskuh> when only accessing: use anonymous struct literals!
edr has quit [Ping timeout: 246 seconds]
edr has joined #zig
neceve has joined #zig
xackus_ has joined #zig
FireFox317 has joined #zig
neceve has quit [Ping timeout: 256 seconds]
<FireFox317> andrewrk, do you use any profiling tools to improve the benchmarks? Ive been following SerenityOS lately and Andreas build his own function level profiler which samples and shows in which function most of the time is spend. I think that makes it so easy to improve code.
<andrewrk> that sounds really useful
<andrewrk> I need to find and learn how to use some of these tools
<companion_cube> perf record/perf report?
<companion_cube> (or perf + flamegraph, it's awesome)
<FireFox317> andrewrk, so how did you find these speed improvements then?
<andrewrk> intuition
<FireFox317> Ah yes indeed
factormystic has joined #zig
<fengb> And measuring right? :P
<FireFox317> I think he measures the complete runtime, but that doesnt tell you anything about where the time is actually spend right
<fengb> I'm just making dumb comments. Please ignore
wozeparrot has joined #zig
xackus_ has quit [Ping timeout: 256 seconds]
wilsonk has joined #zig
wilsonk has quit [Ping timeout: 265 seconds]
wilsonk has joined #zig
satchmo has joined #zig
cole-h has joined #zig
stripedpajamas has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
satchmo has quit [Quit: WeeChat 2.8]
satchmo has joined #zig
FireFox317 has quit [Ping timeout: 246 seconds]