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/
a_chou has joined #zig
gazler__ has quit [Remote host closed the connection]
gazler__ has joined #zig
xackus_ has quit [Ping timeout: 268 seconds]
xackus_ has joined #zig
ur5us__ has joined #zig
tdeo has quit [Remote host closed the connection]
forgot_password has quit [Read error: Connection reset by peer]
a_chou has quit [Remote host closed the connection]
tdeo has joined #zig
a_chou has joined #zig
nvmd has quit [Quit: Later nerds.]
earnestly has quit [Ping timeout: 240 seconds]
spacelove has joined #zig
a_chou has quit [Quit: a_chou]
spacelove has quit [Quit: Connection closed]
<g-w1> andrewrk: for your most recent comment, stage1 cannot even do that (@errorToInt(errorunion)), and I cannot see a use case either?
<andrewrk> ah interesting
<g-w1> https://clbin.com/XMmmM this fails with ./test.zig:4:21: error: expected type 'anyerror', found 'anyerror!u32'.
<g-w1> we also need to do a catch handle ub if the error union is not an error
<g-w1> what was your use case in mind?
<andrewrk> alright let's match stage1 then and I'll make a note to re-examine the lang ref
<g-w1> ok
<andrewrk> nice work g-w1 :)
<g-w1> thanks :). hopefully once you get error sets working i can add tests for errorToInt
bens has joined #zig
<g-w1> are you also doing inferred error sets now? or just making the regular ones lazy in antipication for that?
gazler has joined #zig
gazler__ has quit [Ping timeout: 240 seconds]
gazler has quit [Ping timeout: 268 seconds]
<andrewrk> I'm only fixing the existing test cases, still not implementing inferred error sets yet, also not making the regular ones lazy yet
<andrewrk> but undoing a little bit of work that shoehorned us into a non-lazy design
<andrewrk> almost done
<g-w1> hmm, ill see how it works ig :)
gazler has joined #zig
gazler_ has joined #zig
dimenus has quit [Ping timeout: 240 seconds]
gazler has quit [Ping timeout: 240 seconds]
gazler__ has joined #zig
meinside has joined #zig
gazler_ has quit [Ping timeout: 260 seconds]
gazler_ has joined #zig
ur5us__ has quit [Remote host closed the connection]
ur5us__ has joined #zig
gazler__ has quit [Ping timeout: 240 seconds]
xackus has joined #zig
xackus_ has quit [Ping timeout: 268 seconds]
xackus has quit [Ping timeout: 268 seconds]
gazler__ has joined #zig
gazler_ has quit [Ping timeout: 265 seconds]
gazler_ has joined #zig
<andrewrk> alright I'm taking on switch next
<g-w1> andrewrk: the error set changes look good. do you see a max on the confugarable error set size? i think u64 is good
gazler__ has quit [Ping timeout: 246 seconds]
<andrewrk> by configurable error set size are you referring to https://github.com/ziglang/zig/issues/786 ?
<g-w1> yes
<g-w1> is the number 4294944680 (radian 10) signifigant?
<g-w1> i feel like it is, but not sure how. im getting segfaults because i am indexing stuff with it and it is out of bounds
<g-w1> could it be 0xaaaaaaaa bitcasted somehow?
<g-w1> hmm, my program only segfaults on debug mode
gazler_ has quit [Ping timeout: 240 seconds]
gazler has joined #zig
<mikdusan> radix? that num is 0xffffa7a8 and the upper 16 bits look unlikely for an index
<g-w1> radix 10
<g-w1> im getting this straight out of std.zig.ast.full.ContainerDecl.ast.members
<g-w1> i think it might be a miscompilation
<g-w1> imma try changin stuff around
gazler has quit [Ping timeout: 268 seconds]
<g-w1> its either a miscompilation or a bug in std.zig.ast
<g-w1> (or a bug in my code, but i dont think it is)
<g-w1> ill try to make a repro
CommunistWolf has quit [Ping timeout: 250 seconds]
gazler has joined #zig
CommunistWolf has joined #zig
<g-w1> tfw it doesn't repro 😢
<g-w1> ok im certain this is a miscompilation
daex has quit [Remote host closed the connection]
daex has joined #zig
<g-w1> making a bug report rn
zuyoutoki has quit [Ping timeout: 246 seconds]
<g-w1> i would be grateful if someone could look at this https://github.com/ziglang/zig/issues/8386
ur5us__ has quit [Ping timeout: 276 seconds]
<g-w1> i really hope this is a bug in llvm and not something in zig stdlib or something i did wrong
<andrewrk> g-w1, this could be a good example to try out https://comby.dev/blog/2021/03/26/comby-reducer on
terinjokes has quit [Quit: ZNC 1.8.1 - https://znc.in]
<g-w1> ok ill try that :)
terinjokes has joined #zig
<g-w1> its getting late and i dont feel like messing around with the opam stuff. if noone comments in a few days ill check that out
daex has quit [Ping timeout: 240 seconds]
daex has joined #zig
decentpenguin has quit [Ping timeout: 246 seconds]
neptunepink has quit [Ping timeout: 252 seconds]
lunamn has quit [Quit: Ping timeout (120 seconds)]
lunamn has joined #zig
daex has quit [Ping timeout: 268 seconds]
sord937 has joined #zig
decentpenguin has joined #zig
vegai has joined #zig
daex has joined #zig
neptunepink has joined #zig
Rum has joined #zig
Rum has quit [Client Quit]
<andrewrk> I'm done for the evening in zir-memory-layout, and have a lot of non-code chores to do tomorrow
waleee-cl has quit [Quit: Connection closed for inactivity]
<andrewrk> ifreund, if you are inspired by 623d5f442c832 to try your hand at switch expressions, go for it, otherwise I'll pick it back up on Tuesday
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
sundbp has joined #zig
<ifreund> andrewrk: probably won't have a chance to take a look at it today, maybe tuesday morning though
tnorth has joined #zig
yyp has joined #zig
cole-h has quit [Ping timeout: 240 seconds]
ur5us__ has joined #zig
skuzzymiglet has quit [Read error: Connection reset by peer]
leon-p has joined #zig
earnestly has joined #zig
Witcher01 has joined #zig
caolanm has left #zig ["Leaving"]
andreao91 has joined #zig
ur5us__ has quit [Ping timeout: 252 seconds]
andreao91 is now known as andreao
andreao has quit [Quit: The Lounge - https://thelounge.chat]
andreao has joined #zig
skuzzymiglet has joined #zig
skuzzymiglet has quit [Client Quit]
RadekCh has joined #zig
yyp is now known as yyp1
yyp1 is now known as yyp
yyp has quit [Quit: now it's safe to turn off your computer]
ericst has joined #zig
sord937 has quit [Ping timeout: 240 seconds]
sord937 has joined #zig
zuyoutoki has joined #zig
skuzzymiglet has joined #zig
nycex has quit [Remote host closed the connection]
nycex has joined #zig
andreao1 has joined #zig
andreao has quit [Ping timeout: 265 seconds]
andreao1 is now known as andreao
andreao8 has joined #zig
andreao has quit [Ping timeout: 260 seconds]
andreao8 is now known as andreao
paulgrmn has joined #zig
paulgrmn has quit [Quit: Leaving]
astronavt has quit [Remote host closed the connection]
astronavt has joined #zig
astronavt has quit [Remote host closed the connection]
astronavt has joined #zig
astronavt has quit [Remote host closed the connection]
astronavt has joined #zig
Snaffu has joined #zig
waleee-cl has joined #zig
midgard has left #zig [#zig]
dimenus has joined #zig
dimenus has quit [Client Quit]
dimenus has joined #zig
<cepheus> There's no way to pass arbitrary (zig) compiler flags through zig build, is there?
ericst has quit [Remote host closed the connection]
ncon has joined #zig
<g-w1> will the zig compiler ever insert a ud2 (illegal instruction) opcode in pure zig code?
<mikdusan> we have stack guard stuff but it just does a @panic when smashed
<g-w1> does panic invoke ud2?
<g-w1> in reference to this issue https://github.com/ziglang/zig/issues/8386
<g-w1> im not seeing any ud2 in the llvm ir, so maybe llvm is inserting it for some reason?
<mikdusan> I don't think so. I put in a panic in OReleaseSafe with your code and didn't get illegal instruction
a_chou has joined #zig
<g-w1> searching up llvm insert ud2 brings up some results for when there is ub it inserts it https://stackoverflow.com/questions/21529308/why-does-clang-generate-ud2-opcode-on-osx
<cepheus> doesn't UD2 get generated for unreachable branched by LLVM?
<cepheus> * doesn't UD2 get generated for unreachable branches by LLVM?
<g-w1> yes, thats what i thuoght, but this seems to be in allocator.dupe
cole-h has joined #zig
<mikdusan> g-w1: while tracking down the first bug, I noticed some really odd behavior stepping through code in getContainer()
<mikdusan> it stepped, then the correct if body got stepped,
<mikdusan> then it went backwards and repeated something
<mikdusan> _that_ kinda smelled like bad codegen
<g-w1> hmm and it does not fail in releasefast mode
<g-w1> only in it *only* fails on releasesafe, not debug or releasefast
<g-w1> removing that call to dupe fixes it. it was trying to dupe bad memory since it was undefined
<g-w1> i think the bug is in std.mem.copy
<g-w1> pub fn copy(comptime T: type, dest: []T, source: []const T) void {// TODO instead of manually doing this check for the whole array // and turning off runtime safety, the compiler should detect loops like // this and automatically omit safety checks for loops @setRuntimeSafety(false); assert(dest.len >= source.len); for (source) |s, i| dest[i] = s;} <- i think the assert should be before the setRuntimeSafety, not after it
<g-w1> hmm moving the assert up does not fix it.
<g-w1> i figured out my immediate bug, so thanks, but this should be looked into ig. do you want me to close the issue, or keep it open and explain what i think is going wrong?
<g-w1> oh nice, you made a repro :)
<mikdusan> heh I tried the 1 liner and it reduced :)
<mikdusan> oh you'll need libc 'cause I'm lazy
<g-w1> yep, it repros for me too
a_chou has quit [Quit: a_chou]
<cepheus> hmm, looks like i found a different variant of https://github.com/ziglang/zig/issues/8041 by mistake
<cepheus> this can apparently also happen if you do the same thing with optionals and orelse
<mikdusan> g-w1: so that was a nice one. two distinct (and I think) independent bugs
<g-w1> yep, thanks so much.
<g-w1> i did not know that llvm could insert illegal instruction
<mikdusan> tbh I am getting more and more surprised at these things that llvm (and clang) are doing with "ub license"
RadekCh has quit [Quit: Connection closed]
<mikdusan> if I grok, we are opting into this sanitizer. but illegal instruction? don't we have the technology to emit text error messages ? :)
<g-w1> on the bright side, my doc generator backend is basically done, now i just gotta do some webdev and hopefully replace the auto-generated docs :) heres a prototype: https://i.imgur.com/3CsfWZ2.png
<mikdusan> ah that's what you're up to
<g-w1> yep, thats why i had all that ast code
neptunepink has quit [Ping timeout: 240 seconds]
dongcarl has joined #zig
neptunepink has joined #zig
astronavt has quit [Remote host closed the connection]
FireFox317 has joined #zig
<FireFox317> I think the zir-memory-layout branch is almost ready to be merged right? I looked into memory leaking of the of the LLVM backend and we are not leaking anything :D
<andrewrk> FireFox317, yep it is very close, the last big remaining item is switch expressions
<andrewrk> then it's just cleanup
<Nypsie> Great work guys!
<FireFox317> ah great!
<g-w1> awesome!
<andrewrk> oh also as a bonus, this branch comes with a nice PoC of inline while, at least the control flow aspect of it (we still need to solve comptime locals)
<FireFox317> another bonus, this branch comes with a rework of the LLVM backend :D
<FireFox317> yourse is cooler tho andrewrk
tadzik has left #zig ["WeeChat 2.3"]
<andrewrk> the llvm rework is nice 😁
<g-w1> do you know if there are any zig wasm search stuffs like https://github.com/jameslittle230/stork? if not i might have write one :)
<Nypsie> Nah, haven't seen anything like that
<g-w1> ok, time to learn about search techniques :)
yyp has joined #zig
<andrewrk> g-w1, are you a student? it's fun watching you get excited and learn about all this different stuff
Akuli has joined #zig
<g-w1> i am a student, but not for computer science, i have learned computer science by myself
<FireFox317> g-w1, what do you study?
<g-w1> i haven't decided yet :P
<FireFox317> ah interesting :P
andreao6 has joined #zig
andreao has quit [Ping timeout: 240 seconds]
andreao6 is now known as andreao
lunamn has quit [Quit: Ping timeout (120 seconds)]
lunamn has joined #zig
nvmd has joined #zig
andreao3 has joined #zig
andreao has quit [Ping timeout: 246 seconds]
andreao3 is now known as andreao
andreao1 has joined #zig
andreao has quit [Ping timeout: 240 seconds]
andreao1 has quit [Ping timeout: 246 seconds]
FireFox317 has quit [Ping timeout: 240 seconds]
frett27 has joined #zig
FireFox317 has joined #zig
<cepheus> aww, enumerating decls is a really useful way to force doc building for an entire module, but naturally it doesn't work in modules where @compileError is used to denote deprected functions
spacelove has joined #zig
<cepheus> hmm, it did also pick up a bit of bitrot in the standard library too by the looks
spacelove has quit [Client Quit]
sundbp has quit [Ping timeout: 260 seconds]
tnorth has quit [Ping timeout: 252 seconds]
wilsonk__ has joined #zig
wilsonk has quit [Ping timeout: 265 seconds]
FireFox317 has quit [Ping timeout: 260 seconds]
ur5us__ has joined #zig
klltkr has joined #zig
kenran has joined #zig
Akuli has quit [Quit: Leaving]
mokafolio has quit [Read error: Connection reset by peer]
sord937 has quit [Quit: sord937]
Snaffu has quit [Ping timeout: 265 seconds]
frett27 has quit [Ping timeout: 246 seconds]
yyp has quit [Quit: now it's safe to turn off your computer]
kenran has quit [Quit: leaving]
dimenus has quit [Ping timeout: 265 seconds]
LewisGaul has joined #zig
<LewisGaul> Hey, I'm having some problems adding a package dependency, I haven't managed to get `exe.addPackagePath()` working. Would anyone be able to take a look to see if there's anything obvious I'm doing wrong?
<LewisGaul> https://github.com/LewisGaul/zig-nestedtext/compare/clap - the import gives a compile error "error: unable to find 'clap'"
scoop018 has joined #zig
wilsonk_ has joined #zig
wilsonk has joined #zig
wilsonk__ has quit [Ping timeout: 246 seconds]
wilsonk_ has quit [Ping timeout: 268 seconds]
sundbp has joined #zig
mokafolio has joined #zig
<LewisGaul> Never mind, the problem seems to be with the run command depending on both the exe and the lib install, where only the exe depends on the package... not sure if this might be considered a subtle bug so will raise an issue in case
spacelove has joined #zig
<spacelove> Found some interesting behavior when trying to make a copy of an array: https://zigbin.io/cc3532
<spacelove> Seems like this shouldn't work, but it does
<spacelove> This is how I would think you have to do it: https://zigbin.io/e7c782
<spacelove> Any idea why they both work? Or seem to? Or is the first one just lucky?
<LewisGaul> Is it that the `.items` field is a pointer that gets reallocated to a different bit of memory when the arraylist grows?
<LewisGaul> If my theory is correct then the first one would just be lucky I think
<spacelove> Hmmm
<spacelove> Intriguing
<andrewrk> yay, finished all my chores today and now I get to do some coding
<LewisGaul> coding > chores :)
<cepheus> https://cepheus.srht.site/phyzfs/docs/ hey these docs aren't coming out so bad
LewisGaul has quit [Ping timeout: 240 seconds]
<andrewrk> cepheus, neat, do you have a fork where you improved the doc gen stuff?
<cepheus> this is all acutally just using the limited markdown support that exists in the current zig compiler, aha
<cepheus> I'm sure it would be possible to do stuff like auto cross-linking as a feature of doc gen though
<andrewrk> yeah I think there is even an issue open for that already
<andrewrk> I'm thinking about having auto generated documentation operate mainly based on the AST, but then potentially being augmented by types and values from semantic analysis
<andrewrk> right now it's only the output from semantic analysis, which leaves out anything that did not get referenced
<cepheus> as i alluded to earlier i worked around that somewhat by doing a very nasty hack of generating the docs through a fake test harness which just iterates over the module's struct decls
LewisGaul has joined #zig
<cepheus> that actually showed some promise in detecting a couple of compile issues with untested bits of std which i might investigate at some point
scoop018 has quit [Quit: This computer has gone to sleep]
krux02 has joined #zig
<krux02> hello people, just new to zig and try out how it works.
<LewisGaul> hello welcome :)
<krux02> can you tell my why the size here is 17: http://ix.io/2Uvr
<krux02> after all the language says that a bool uses exactly one bit https://ziglang.org/documentation/master/#toc-packed-struct
ur5us__ has quit [Ping timeout: 258 seconds]
<LewisGaul> good question, I'm not familiar with packed structs in zig, maybe someone else can help
<krux02> it looks to me like a bug.
<krux02> until 8 bool values, the struct has 9 bytes.
<krux02> With the 9th bool field, the struct suddenly increases to size 9+8=17
<mikdusan> packed structs will improve with self-hosted compiler which is under heavy development right now. The current stage1 compiler support for packed structs has bugs and many issues are open against it
<krux02> ok, good to know.
<andrewrk> I get a security certificate failure when I try to look at the code
<krux02> why security certificate failure?
<andrewrk> with http my ISP performs a man-in-the-middle attack on me
<krux02> you have problems with ix.io, or is your ide telling you something about my code?
<andrewrk> so I tried https but it has an invalid certificate
<krux02> yea there is no https
<krux02> it is just http
<krux02> non encrypted raw text
<krux02> you can get it with curl
<andrewrk> krux02, there is a compiler bug with packed structs whose bits do not add up to a byte boundary
<krux02> I also looked at normal structs.
<krux02> As the specification says, it might reorder the fields.
dingenskirchen has quit [Quit: ZNC 1.8.1 - https://znc.in]
<krux02> Then I created a struct where a simple reorder would significantly reduce the size and it didn't happen.
<andrewrk> not implemented
<krux02> The struct was still as if it would be a C struct?
dingenskirchen has joined #zig
<krux02> Is this just a placeholder for the future to reorder fields one day in the future?
<andrewrk> yes, it's important to make sure to reserve the right to do this early, otherwise people might write code that relies on something that will change
<krux02> ok, that todo is now 5 years old.
<krux02> almost
<g-w1> hopefully it will get fixed in the next year :)
<krux02> apart from my concern that these "optimizations" are even a good idea, letting issues open for 5 years open for core features of the language like struct is a bit unsettling.
<andrewrk> well why didn't you fix it yet then?
<krux02> I've used the language for about 10 minutes and already hit a compiler bug.
<mikdusan> what I like is these features have been thought about already, are recorded, tracked, and factored as development progresses
<andrewrk> come back after 1.0 if you want to not hit bugs
<krux02> andrewrk, yea probably will do that.
earnestly has quit [Ping timeout: 240 seconds]
<krux02> Don't take it personal, I got recently burned by a language that had too many bugs. Can't afford to do it again.
<krux02> Thanks for the help.
<mikdusan> I'm having one of those zero-attention span days. Can't focus on anything :(
<andrewrk> sometimes I have those days. my strategy is to close all applications except editor, and put my phone in another room
<mikdusan> ah yeah I heard you mention doing that just recently
<g-w1> is there an equavalent of mkdir -p in zig stdlib?
<mikdusan> makePath ?
<andrewrk> see also makeOpenPath
<g-w1> thanks
<andrewrk> surprisingly windows wins the syscall contest on this one, you can do makeOpenPath in 1 syscall on windows
<g-w1> it seems like the impl doesn't do that though? it just loops through all the sub-paths
<andrewrk> all os's have to do that, but nt lets you create a dir and open it at the same time
<g-w1> ohh i see
<mikdusan> I remember being absolutely blown away by subdirs. Apple DOS never had them then came ProDos which added subdirs. and in the meantime cp/m had them (iirc)
earnestly has joined #zig
spacelove has quit [Quit: Connection closed]
LewisGaul has quit [Ping timeout: 240 seconds]
krux02 has quit [Remote host closed the connection]