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/
<marler8997> PR for dynamic build deps part 1 here: https://github.com/ziglang/zig/pull/8072
<g-w1> so the user has to manually provide pkg-begin and pkg-end? or will the build_runner re-exec itself like you showed in the original issue
<g-w1> s/build_runner/build.zig
<marler8997> the package manager would provide --pkg-being to build.zig
<g-w1> how does it know what packages?
<marler8997> of course the user could provide it as well
<marler8997> that's part 2
<g-w1> ah :)
<marler8997> part 2 is pretty small, just adding a needed_package field to Builder, and a bit of logic in build_runner to print them and error if they are missing
<marler8997> actually I think it could be done completely independently now that I think about it
<g-w1> well it needs the eventual pm tho?
<marler8997> actually it can be implemented today
<marler8997> it's just a simple list of packages and an interface to query them
<g-w1> yeah, but eventually it will need to integrate with the pm
zups has joined #zig
ur5us has joined #zig
<andrewrk> g-w1, where was astgen.zig doing `error.Foo` syntax before the big branch merge?
<andrewrk> I'm trying to find the old code for reference
<g-w1> it was in zig_sema.zig
<g-w1> it was just analyzeInstFieldPtr on anyerror type
<g-w1> I actually have a proposal related to this that I will write up soon
<andrewrk> ah I see
<g-w1> now its namedFieldPtr
<g-w1> zir_sema.zig:4038
<andrewrk> hmm I don't see where the global error value is incremented
<g-w1> thats in module
<andrewrk> I see, it's part of getErrorValue
<andrewrk> thanks!
<g-w1> yep, are you taking on inferred error sets? I think I have given up on them because im not that comfortable with graph algs
<g-w1> or for now until i get more comfortable with graphs
<andrewrk> no I'm just fixing the master branch test failures due to (implicit) merge conflicts after merging your catch at comptime PR + the big ast mem layout one
<g-w1> oh, ok
<andrewrk> such big sweeping changes are bound to be messy; this is just the natural aftermath :)
<andrewrk> I think we're in danger of putting too much logic inside Type/Value
<g-w1> also zir_sema.zig should be formatted (after my merge) since the else formatting got updated :)
<g-w1> (not putting a newline after an else without a block)
<ed_t> is the showtime discord closed?
<g-w1> no, did the invite run out?
nvmd has quit [Quit: Later nerds.]
<ed_t> where is the invite?
<g-w1> zig.show
nvmd has joined #zig
<ed_t> zig.show ?
<ed_t> somedays I am thick. Thanks
<andrewrk> in your defense it is a surprisingly slick URL :)
<andrewrk> the Value for error sets should not encode the error number, for a couple reasons
<andrewrk> (1) it can be stored in a separate table, saving memory for each instance of the Value
<andrewrk> (2) this way threads do not need to obtain a lock on the lookup table of name->value if they do not need to evaluate @errToInt or @intToErr which are both rare
<g-w1> what would it store? a string?
<g-w1> it should not need both
<andrewrk> just the name
<g-w1> ah, makes sense
<andrewrk> so analysis can go straight from `error.Foo` syntax to Value, without any locks
<g-w1> yeah, also I think we can use a hashset instead of a hashmap for error sets too since module has the definitive list
<g-w1> I think it would be HashSet([]const u8); to see if something exists in the error set just do a lookup. not sure why the values were needed when they can be gotten from module on demand
<andrewrk> yeah
<andrewrk> memoizing the errors to integers would probably be faster if we were doing the work of compilation fresh every time (i.e. stage1) but for incremental compilation it works much better to be based on names
<andrewrk> also threads
<andrewrk> in about 1 hour I'll be streaming working on the llvm12 branch of zig: https://www.twitch.tv/andrewrok
<g-w1> so 3 things to do are (1) make value only store a string, (2) make a error set hashset(string), (3) move errorset to type.zig from value
<g-w1> ill start working on this; telling you to avoid duplicated work
<daurnimator> marler8997: I don't think --pkg-begin would work......... command line arguments can only be so long
<daurnimator> wouldn't it not be unheard of to have e.g. 100 packages?
_whitelogger has joined #zig
<andrewrk> g-w1, cool thanks
<marler8997> daurnimator, could be a problem for specifying pkgs on the project itself
<marler8997> much less of a change of it becoming an issue for build.zig's direct dependencies
<marler8997> *chance
<marler8997> Zig could also support a response file if they get too long
<marler8997> that's a common solution
<marler8997> anyone on here familair with how zigmod works, I wanted to discuss what it would take to get it to support dynamic build dependencies with the newly proposed feature
<marler8997> if we can get it to support them, I'll probably add support for it in some of my projects, including ziget/zigup
<g-w1> i think meghan hangs out on thi discord server mostly
<marler8997> it's good to get these features tested in some real world scenarios
<marler8997> I'll check there
<mikdusan1> andrewrk: #8073 for llvm2 if you haven't done it already
<mikdusan1> s/llvm2/llvm12
<marler8997> when's the llvm12 transition going to happen?
<mikdusan1> yesterday :P
<g-w1> today
<noam> g-w1: haha, true :P
<noam> Not sure I"d want to, though
<noam> I think it's good as is :)
<g-w1> ok, just checking
sebonirc has quit [Quit: sebonirc]
n0tekky has quit [Quit: Leaving]
philtor has quit [Remote host closed the connection]
xackus has joined #zig
xackus_ has quit [Ping timeout: 256 seconds]
ur5us has quit [Ping timeout: 272 seconds]
_whitelogger has joined #zig
tomku|two has quit [Ping timeout: 272 seconds]
tomku has joined #zig
terinjokes has quit [Quit: ZNC 1.8.1 - https://znc.in]
terinjokes has joined #zig
philtor has joined #zig
earnestly has quit [Ping timeout: 260 seconds]
a_chou has joined #zig
craigo has quit [Ping timeout: 276 seconds]
a_chou has quit [Remote host closed the connection]
zupssss has joined #zig
mikdusan1 is now known as mikdusan
jsb has quit [Quit: .]
KoljaKube has quit [Quit: buh-bye]
jsb has joined #zig
xackus has quit [Read error: Connection reset by peer]
jsb has quit [Quit: .]
xackus_ has joined #zig
proteusguy has joined #zig
jsb has joined #zig
sord937 has joined #zig
zupssss has quit []
zups has quit []
kbd has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
cole-h has quit [Ping timeout: 272 seconds]
osa1 has quit [Read error: Connection reset by peer]
osa1 has joined #zig
osa1 has quit [Quit: osa1]
osa1 has joined #zig
earnestly has joined #zig
zups has joined #zig
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
emptee has joined #zig
leon-p has quit [Quit: leaving]
leon-p has joined #zig
emptee has quit [Quit: Konversation terminated!]
zups has quit []
wilsonk has joined #zig
Interplanetary has joined #zig
kubkon has joined #zig
* kubkon
kubkon has left #zig ["WeeChat 3.0.1"]
kubkon has joined #zig
<kubkon> exit
<ifreund> o7
knebulae has joined #zig
kubkon has quit [Quit: WeeChat 3.0.1]
kubkon has joined #zig
bitmapper has joined #zig
Flaminator has joined #zig
kubkon has quit [Ping timeout: 276 seconds]
gpanders has quit [Remote host closed the connection]
gpanders has joined #zig
gpanders has quit [Remote host closed the connection]
gpanders has joined #zig
kubkon has joined #zig
craigo has joined #zig
<marler8997> maybe someone has an idea here, with our new build "hasPkg" design, hasPkg returns a bool so it's not automatically computed at comptime
<marler8997> @tryImport didn't have this problem because it returned ?type so it HAD to be compiled at runtime
<marler8997> and I can't add a tryImport wrapper to hasPkg because Zig is planning on removing the ability to use a comptime string to call @import
<marler8997> does anyone have a clever idea that would force hasPkg to be done at comptime, so the user doesn't accidently miss it and then their build.zig file won't work with a particular configuration
<marler8997> like, if comptime_bool existed that would be one solution
<marler8997> I know there was a proposal about this as well
<g-w1> make it a global var? do those have to be const evalable?
<g-w1> like top-level not in func
<marler8997> buildpkgs only exposes the list of packages given by the user
<g-w1> ah
<g-w1> make it inline?
<marler8997> oooo, would that work?
<marler8997> I will try
<g-w1> maybe if its inline surrounded by comptime block?
geemili has quit [Ping timeout: 264 seconds]
<Flaminator> Have there been any discussions/proposals about a split between what could be considered core zig items and the std items?
<ifreund> Flaminator: what is the difference between "core" and "std"?
<marler8997> g-w1, callconv(.Inline) not enough, maybe the comptime block could do it
<g-w1> im thinking comptime block over the callsite: comptime { hasPkg(); }
<marler8997> g-w1, yeah that works
<marler8997> but that's the problem I'm trying to avoid
<marler8997> because if the caller forgets to specify comptime
<marler8997> then their build will work in some cases, and fail in others, which is what I'm trying to avoid
Snaffu has joined #zig
<g-w1> you can detect if its running at runtime and throw a panic telling them to use comptime
<marler8997> ooo, how to do?
<g-w1> there was some hack with type coerceion
<marler8997> here's the issue where it looks like the plan is to use inline to enable this: https://github.com/ziglang/zig/issues/425#issuecomment-754572088
<Interplanetary> Hi everyone! I am currently working on porting the https://github.com/ulfjack/ryu float parser into the standard library but saw that it was licensed under Boost / Apache-2. Is this an issue? Should I write Ulf Adams to ask if he would add MIT as a license option for us?
<g-w1>
<g-w1> marler8997: exploit peer type resolution ftwpub fn isComptime() bool {var t: bool = true; const x = if (t) @as(u7, 0) else @as(u8, 0); return @TypeOf(x) == u7;}
<Flaminator> ifreund, I see core as things that are part of the language itself and are used by builtins. I see std as an "offical" library written on top of the language using language features.
<g-w1> Flaminator: see builtin.zig, start.zig, debug.zig
<ifreund> start.zig and debug.zig aren't part of the language itself
<ifreund> builtin.zig is
<g-w1> ah
<Flaminator> I knew about builtin.zig yes, start.zig and debug.zig look like they contain platform dependent stuff.
<ifreund> this distinction isn't really that important for zig though since everything is lazy
<ifreund> builtin used to be accessible with @import("builtin") instead of @import("std").builtin, you may want to look for the discussion that caused that to be changed
<g-w1> marler8997: i think the inline thing with comptime behavior is implimented in stage2 (not 100% sure tho)
<ifreund> Interplanetary: pretty sure Apache-2 is no problem, it's compatible with MIT. did you see this issue? https://github.com/ziglang/zig/issues/1299
<marler8997> g-w1, it's not a pretty solution, but at least now the function will always fail when comptime is not specified
<g-w1> yeah
<ifreund> Interplanetary: and this which is linked in that thread if you missed it: https://github.com/tiehuis/zig-ryu
<ifreund> wait you're not tiehuis are you?
<marler8997> there's the commit that now forces the user to specify "comptime" when the call has
<g-w1> cool
<g-w1> wait wat
<g-w1> if (!isComptime()) @compileError();????
<g-w1> this will just compile error every time right?
<g-w1> did you test it?
<g-w1> i think it should panic
<marler8997> seems to work
<marler8997> why would it have a compile error every time?
<g-w1> oh, i guess the compileError only gets evaluated when it is runtime
<marler8997> right
<g-w1> it still seemed weird to me
<marler8997> maybe I should be marking the call to isComptime as comptime
<marler8997> actually that might make it always return true?
<marler8997> I should write a test that ensures this causes has without comptime to fail
<g-w1> idk, the semantics are very blurry i think
supercoven has joined #zig
kubkon has quit [Ping timeout: 240 seconds]
dyeplexer has joined #zig
<Interplanetary> ifreund: No, I'm https://github.com/InterplanetaryEngineer =D I saw tiehuis's project; the last commit was a about a year ago, and it seems like a very literal translation.
Swahili has joined #zig
wilsonk_ has joined #zig
wilsonk has quit [Ping timeout: 276 seconds]
wilsonk_ has quit [Read error: Connection reset by peer]
wilsonk__ has joined #zig
wilsonk_ has joined #zig
wilsonk has joined #zig
jaafarrc has joined #zig
<jaafarrc> Why are tabs not allowed in Zig?
wilsonk__ has quit [Ping timeout: 276 seconds]
wilsonk_ has quit [Ping timeout: 276 seconds]
<jaafarrc> oh ok
jaafarrc has left #zig [#zig]
<marler8997> g-w1, look at this beauty...even tests that not using has with comptime will create a compile error: https://github.com/ziglang/zig/pull/8072/commits/aec0f135356de6878fd90d5466236c0a4c407e54
<Swahili> I have a Node struct that have some fields that are common in TypeA and TypeZ struct; And I have a function that does some computation and might return TypeA or TypeZ, ideally has Node, as this have the common fields! How can I solve this in Zig? `Union` is to be used with primitive types only, am I wrong?
<g-w1> probably union(enum) since you want a tag
<Swahili> g-w1: I tried but thought it doesn't work with struct
<Swahili> const Node = union { typeA: TypeA, typeB: TypeB }, something like that?
<marler8997> union(enum)
<g-w1> Swahili: please read the docs on tagged unions
<Swahili> Yes! Currently reading. I'm quite confused at the moment though. I'll try something and share if you people don't mind have a look.
<Swahili> Thank you!
<g-w1> lemonboy to the rescue!
kbd has joined #zig
<Flaminator> ifreund I tried searching for an issue/pr that discusses the move from @import("builtin") to std.builtin but I can't find it on the github repo because there are many issues and prs which contain import and builtin.
fgenesis has quit [Ping timeout: 260 seconds]
kbd has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
<g-w1> andrewrk: here is part 1 of what we talked abt yesterday https://github.com/ziglang/zig/pull/8079
kbd has joined #zig
<Swahili> @g-w1 tagged unions, this is great! Very basic but nice to learn, thank you! https://paste.sh/6D7C4H91#W357yZ3nBu929PMf32yCBHZb
<dutchie> sum types \o/
<g-w1> Swahili: read about how to capture from a switch and union(enum) too! its pretty cool
<Swahili> yeh I think I did that, very basic, is that what you mean with capture switch and union? https://paste.sh/6D7C4H91#W357yZ3nBu929PMf32yCBHZb
<g-w1> no, read the part about tagged unions here https://ziglang.org/documentation/master/#switch
<dutchie> switch (c) { .img => |content| { do stuff with content }, ... }
<Swahili> Oh! Thank you :D
nvmd has quit [Ping timeout: 276 seconds]
mikdusan has quit [Read error: Connection reset by peer]
mikdusan has joined #zig
<Flaminator> I have no idea how I read over the last bit of the comment, that was the first pull request I found myself. I still think that having a core(@import("zig") for example) besides the std
nvmd has joined #zig
kbd has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
nvmd has quit [Ping timeout: 265 seconds]
mikdusan has quit [Quit: WeeChat 3.0.1]
<marler8997> g-w1, I had an idea to put the packages in builtin.zig instead, I was able to leverage more existing code, I've updated the PR if you want to have a look
<g-w1> ok
Akuli has joined #zig
mikdusan has joined #zig
<marler8997> daurnimator, I think I found a way around your idea to add a whitelist for running external commands in build.zig that I'm not sure how you could plug
<marler8997> there's a "run.zig" file which pretty much just takes a command to run, so build.zig builds run.zig as an exe and passes the command for it to run, then calls it
hnOsmium0001 has joined #zig
Interplanetary has quit [Ping timeout: 240 seconds]
zups has joined #zig
zups has quit [Client Quit]
cole-h has joined #zig
kbd has joined #zig
dyeplexer has quit [Remote host closed the connection]
nvmd has joined #zig
<marler8997> I've got multi-level build.zig dependencies worked out now, with a test in the PR!
kbd has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
Snaffu has quit [Ping timeout: 256 seconds]
Snaffu has joined #zig
Snaffu has quit [Ping timeout: 264 seconds]
Snaffu has joined #zig
kbd has joined #zig
sord937 has quit [Quit: sord937]
brzg has joined #zig
<andrewrk> marler8997, that was fast
<marler8997> yeah, still working on a bug though
<marler8997> I'm going to have to go back to the @import("buildpkgs") instead of using std.builtin because we're only compiling one version of builtin.zig per compilation (not one per package)
<marler8997> and each package has it's own sub-package set
<andrewrk> mikdusan, pushed a commit to llvm12; it builds now
<marler8997> so, is there one Compilation object for the full package set?
<andrewrk> yes but there are sub-Compilations for compiler-rt, libc, etc
<marler8997> got it
<andrewrk> there is also only one Module for the full package set
<marler8997> oh...
<andrewrk> Module represents all the zig code only
<marler8997> hmmm
<andrewrk> Compilation includes C objects, other dependencies such as compiler-rt, and linking
<andrewrk> Module is concerned only with .zig code => machine code
<marler8997> right, trying to figure out how to generate buildpkgs.zig
<marler8997> I was thinking each package would get it's own
<marler8997> actually, I could generate buildpkgs-PKGNAME.zig
emptee has joined #zig
Snaffu has quit [Quit: Lost terminal]
notzmv has joined #zig
midgard has quit [Read error: Connection reset by peer]
<mikdusan> andrewrk: yup can confirm llvm12 now builds zig on macos. is that lemonboy's patch?
midgard has joined #zig
<andrewrk> oh, oops, I didn't see his PR
<andrewrk> damn, would have saved me some time just now
<mikdusan> it's close to identical . uhm, he has ArgNo + 1
<andrewrk> mikdusan, can you do a git blame on that deleted v0_gcc_personality file and make sure that's not something intentionally added?
<mikdusan> will dig...
<andrewrk> `git log -p -- lib/libunwind/src/gcc_personality_v0.c` reveals that it's intentional
<andrewrk> unfortunately I did not explain why, damn it
<andrewrk> anyway let's leave that file untouched
<mikdusan> ok I'll put it back in and force-push my PR
ur5us has joined #zig
ur5us has quit [Quit: Leaving]
<mikdusan> done. src/libcxx.zig and libunwind.zig both do not require change. and gcc_personality is untouched
kbd has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
kbd has joined #zig
Swahili has quit []
sebonirc has joined #zig
emptee has quit [Quit: Konversation terminated!]
brzg has quit [Quit: leaving]
<andrewrk> thanks!
<mikdusan> on macos my current state is: zig artifact is produced. cannot use `zig build` or `zig test` . some inline assembly error comes up. very simplistic zig build-obj seems to work if I override @panic(), otherwise a usize vs. u64 error pops up
<andrewrk> the next thing that needs to happen is an audit of x86 cpu target features
kbd has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
kbd has joined #zig
<andrewrk> mikdusan, check the commit message on 8f1408578cb255fbbdc555d746b25cefb331105e
<mikdusan> ok so you did that against llvm12 branch head at that time. hopefully we have less delta
<andrewrk> that delta is big because it was against what jakub did, not understanding how the process worked
<andrewrk> right now I'm looking into redoing the https://github.com/ziglang/zig-llvm-target-details-generator project because I think it has some flaws and also it broke with llvm 12
<andrewrk> also it's in python! wtf!
<mikdusan> I left python a long time ago for ruby
<andrewrk> the point is it's not in zig :)
* ed_t thinks andrewrk has a vested interest in seeing zig used...
midgard_ has joined #zig
midgard has quit [Ping timeout: 264 seconds]
geemili has joined #zig
cole-h has quit [Ping timeout: 265 seconds]
Akuli has quit [Quit: Leaving]
<andrewrk> doing another llvm12 update stream
<andrewrk> in about 10 min https://www.twitch.tv/andrewrok
<g-w1> does the next stage2 build now? I saw that you said on the issue that you would run the test suite, does this mean the test suite compiled?
<mikdusan> still not there.
<g-w1> hmm, so you will try to do the same thing without that petty parsing bug that you were doing yesterday?
<mikdusan> boy does llvm ever love their tables
<andrewrk> will be working on re-doing cpu features
<mikdusan> it's funny how lemonboy was mentioned last night during twitch.tv and sure enough he made a fly-by and parachute dropped a PR against `sret` issue
sawzall has quit [Read error: Connection reset by peer]
sawzall has joined #zig
kbd has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
kbd has joined #zig
hnOsmium0001 is now known as hnOsmium0002
hnOsmium0002 is now known as hnOsmium0001
leon-p has quit [Remote host closed the connection]