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/
<xcko> actually I may have built from master 0.4.0 - disregard
<xcko> ./zig version; 0.4.0+
curtisf has joined #zig
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 245 seconds]
curtisf has quit [Quit: Page closed]
THFKA4 has joined #zig
daex has joined #zig
jevinskie has joined #zig
curtisf has joined #zig
fengb has quit [Ping timeout: 256 seconds]
fu5ha has joined #zig
<andrewrk> AlexMax, note that in zig `inline` is force inline
<andrewrk> (I think you already knew that, but there are 104 people in here)
hio has joined #zig
<andrewrk> mikdusan1, I know why ArenAllocator deinit is failing
<mikdusan1> ir_gen_while_expr ?
<mikdusan1> tell me
<andrewrk> here's the LLVM IR: https://clbin.com/DeTdY let me explain it
<andrewrk> looking at the source code for deinit(), in the result location branch, the variable `node` no longer is an extra allocation. it is actually a reference directly to the payload of `it`
<mikdusan1> something to do with duplicate %it ?
<andrewrk> so `it = node.next` directly modifies `node`
<mikdusan1> yup with you so far
<andrewrk> because in the case of ?*T, `it` and `node` refer to the exact same memory location
<andrewrk> but master branch depends on different semantics
<andrewrk> it depends on `it` and `node` being separate memory locations
<andrewrk> master branch assumes that `node` has a copy of `it`, but in result location branch it's not true
<andrewrk> this is an important decision for the language specification
<andrewrk> I'm inclined to make the result location semantics the new correct semantics, because it means less memcpy, and it seems a reasonable restriction to live with
<andrewrk> but I have to admit it's a bit of a footgun
<andrewrk> mikdusan1, so this is the fix: https://clbin.com/jfsn4
<andrewrk> 0x000000000077d510 in zig.ast.AsyncAttribute.firstToken (self=0xaaaaaaaaaaaaaaaa) that `self` memory address, hmmmmmmmmmmmmmmmmmmmmmmm
<mikdusan1> i like that `node` would no longer force a new slot
<andrewrk> oh shit! zig links now
<mikdusan1> :)
<mikdusan1> on macOS we need that 1-liner to fix __mh_execute_header symbol
<andrewrk> oh I thought I merged that
<fu5ha> It is merged i believe
<curtisf> unrelated question: given a tagged-union `T: type` and a field name `n: []const u8`, what's the right way to get the type of T's field named n?
<mikdusan1> my meaning was 2711 not yet merged to copy-elision-3 branch
<andrewrk> ahhh ok let me merge master
<andrewrk> mikdusan1, pushed
<mikdusan1> heh nice to know you `zig0` but step aside. we'll be talking to `zig` from now on :)
jevinskie has quit [Quit: Textual IRC Client: www.textualapp.com]
<mikdusan1> zig links for me on macOS - has 2 ld warnings that I'll look into.
<andrewrk> much appreciated
curtisf has quit [Quit: Page closed]
<mikdusan1> the 2 macOS ld warnings go away if not using Xcode 11 beta2, so not going to worry about them right now
<andrewrk> sounds good
_whitelogger has joined #zig
marijnfs has joined #zig
jjido has joined #zig
jjido has quit [Client Quit]
_whitelogger has joined #zig
samtebbs has joined #zig
brett-soric has joined #zig
samtebbs has quit [Ping timeout: 248 seconds]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
samtebbs has joined #zig
fu5ha has quit []
fu5ha has joined #zig
fu5ha has quit [Remote host closed the connection]
fu5ha has joined #zig
wootehfoot has joined #zig
fu5ha has quit [Remote host closed the connection]
fu5ha has joined #zig
fu5ha has quit [Remote host closed the connection]
fu5ha has joined #zig
fu5ha has quit [Remote host closed the connection]
fu5ha has joined #zig
brett-soric has left #zig [#zig]
fu5ha has quit [Remote host closed the connection]
fu5ha has joined #zig
fu5ha has quit [Remote host closed the connection]
fu5ha has joined #zig
fu5ha has quit [Remote host closed the connection]
fu5ha has joined #zig
fu5ha has quit [Remote host closed the connection]
fu5ha has joined #zig
jjido has joined #zig
fu5ha has quit [Remote host closed the connection]
IntoxicatedHippo has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
IntoxicatedHippo has quit [Quit: Leaving]
ace-_ has quit [Remote host closed the connection]
jjido has joined #zig
redj has quit [Read error: Connection reset by peer]
redj has joined #zig
<tgschultz> curtisf: std.meta.TagPayloadType(T, T.n);
<tgschultz> which could be cleaned up now with enum literals so you only needed `std.meta.TagPayloadType(T, .n);`
<geemili> j
daex has quit [Ping timeout: 245 seconds]
<gonz_> How exactly does one use `usingnamespace`? Alternatively, how do I get at the `bits.zig` files for the platforms?
<Tetralux> gonz_, I believe you can `use @import(...)`
<tralamazza> gonz_: not sure about 0.4, i am using master, but you prepend usingnamespace to your @import and it makes the pub symbols visible to the current namespace, no need to use a const
<tralamazza> i am also a beginner here
<tralamazza> gonz_: https://github.com/tralamazza/embedded_zig/blob/master/main.zig#L1 RCC, GPIOC become visible
<gonz_> Yeah, it's not the command that's the problem, it's actually not being able to get the bits files from the standard library.
<tralamazza> i guess the name comes from c++ using namespace
<tralamazza> a bit shlong as a keyword, but it works
<gonz_> Does anyone have a repository with the bindings to Win32 that shows clearly how to make these bindings without the bits files or by somehow getting at the bits files from the standard library?
<andrewrk> gonz_, std.os has all those declarations in it
<andrewrk> e.g. std.os.O_CLOEXEC
<gonz_> Yeah, I tried that but got this: `container 'std.os' has no member called 'LPCSTR'`
<andrewrk> oh, that's in std.os.windows
<andrewrk> std.os has POSIX stuff
<gonz_> Ugh, yeah, tried that just now :/
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mikdusan1 has quit [Ping timeout: 268 seconds]
mikdusan1 has joined #zig
<AlexMax> How self contained is zzig on windows?
<AlexMax> Do I need an SDK installed? Or Visual C++ installed? And if I dont need it for standard stuff, when would I need it?
<AlexMax> I already have MSVC installed so I dont know what I would be nissing by not installing it or ehatever SDK
<AlexMax> like a windows SDK for example
IntoxicatedHippo has joined #zig
samtebbs has quit [Quit: Lost terminal]
return0e has quit [Remote host closed the connection]
return0e has joined #zig
<gonz_> You would think I would be able to answer this since I built the compiler very recently on Windows but I've dumped so many runtime libraries onto this box in such a short time that I don't even know if I just have the correct set of dependencies installed.
<AlexMax> Okay, so let's say that somebody wants to build a zig program or static library as part of their build process, and they have their own build system and presumably might not even have zig installed. I'm wondering if it's just a matter of "download zig, extract it someplace, use zig to build the library, done"
<AlexMax> like, treating the zig compiler as if it was a dependency or something
<daurnimator> AlexMax: yes you can. but only for programs that don't need windows headers
<daurnimator> IIRC we don't have many windows C function definitions shipped with zig
moo has joined #zig
wootehfoot has quit [Ping timeout: 245 seconds]
<IntoxicatedHippo> Am I doing something wrong here that would cause the stack to not be aligned correctly? https://github.com/liampwll/zig-efi-os/blob/master/Makefile
<IntoxicatedHippo> Zig is generating a movaps instruction which is causing a GP fault
wootehfoot has joined #zig
moo has quit [Client Quit]
jjido has joined #zig
<AlexMax> hrm, no response to https://github.com/ziglang/zig/issues/2712
<AlexMax> I hope my question wasn't due to my ignorance or something
<Tetralux> My understanding -- though I could be wrong -- is that unless you do `--library c` etc the executable Zig produces has no dependencies. Correct if wrong.
<Tetralux> If I am, then I'd also like to know :p
return0e has quit [Ping timeout: 248 seconds]
return0e has joined #zig
<andrewrk> AlexMax, you need msvc to build zig on windows, and llvm+clang libraries. that's it. the std lib has no dependencies, not even on libc
<andrewrk> you can get the llvm+clang libraries prebuilt (by me) from https://github.com/ziglang/zig/wiki/Building-Zig-on-Windows
<andrewrk> AlexMax, I'll get to your issue - sorry been focused on finishing up this result location branch
<andrewrk> I believe the answer to your question above about download/extract/build library is "yes". That works today, if you run into issues I'd like to know about them
<andrewrk> the windows binaries on ziglang.org/download are entirely self-contained, you need nothing else installed. however if you want to link libc, you have to have msvc. however it is planned for zig to even provide a windows libc without msvc
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<scientes> linux binaries too
<AlexMax> andrewrk: Okay, no rush, I just wanted to make sure that the issue was like....comprehensible
<AlexMax> Sometimes I see things that make go "Wait...what are they talking about?"
<andrewrk> IntoxicatedHippo, do you know what source that movaps corresponds to?
<andrewrk> IntoxicatedHippo, is there a reason you can't use zig's lld to do the link, and use build-exe? did you run into a bug?
<andrewrk> do we need to change the linker flags passed for UEFI?
jjido has joined #zig
donpdonp has joined #zig
curtisf has joined #zig
<IntoxicatedHippo> andrewrk, This line from fmt.zig, I've tried adding align 32 and I still have the same issues so it's almost certainly something to do with stack alignment: var buf: [math.max(@typeOf(value).bit_count, 1)]u8 = undefined;
<andrewrk> IntoxicatedHippo, try this: var buf: [math.max(@typeOf(value).bit_count, 1)]u8 align(16) = undefined;
fu5ha has joined #zig
<andrewrk> if that solves the problem it's a clue but you shouldn't have to do that
<andrewrk> we might be missing safety checks for @alignCast, I need to double check
<IntoxicatedHippo> Still have the same issue with that
<fu5ha> hey! back again with another question :p any chance someone could look at vec2 and vec3 and see why vec2 compiles and runs perfectly but vec3 errors out? Specifically on the array access lines; here's an error log https://gist.github.com/termhn/9ad4a44ea94c0de9aec300cb34c3e7db
<mikdusan1> smells like an alignment issue. comparing llvm-ir master, it used to invoke memcpy with aligns. and now it efficiently uses a store but i don't see any alignment
<mikdusan1> on linux it doesn't crash because the stack variable is aligned at 16 byte for whatever reason. on macOS result_var ends up on 8-byte align.
<IntoxicatedHippo> I haven't been able to work out how to get Zig's linker to do what I want, I assume build-exe if meant to do it, but that fails silently
<andrewrk> damn. it's not supposed to do that
<IntoxicatedHippo> I've just realised there's a --verbose-link option, the command it invokes gives this output: Invoke ld.lld (Unix), ld64.lld (macOS), lld-link (Windows), wasm-lld (WebAssembly) instead
<IntoxicatedHippo> Using lld-link instead gives this output: Invoke ld.lld (Unix), ld64.lld (macOS), lld-link (Windows), wasm-lld (WebAssembly) instead
<IntoxicatedHippo> subsystem should be efi-application
<emekankurumeh[m]> IntoxicatedHippo is your stack aligned correctly?
<IntoxicatedHippo> or efi_application rather
<andrewrk> mikdusan1, if the store/load instruction doesn't have an align attr, it uses ABI align of the type
<andrewrk> can I see a paste of the llvm ir?
<emekankurumeh[m]> i.e. @setStackAlign
<IntoxicatedHippo> emekankurumeh[m], using Zig's linker command? No
<andrewrk> IntoxicatedHippo, the startup code on windows does an align stack thing, maybe we need that for UEFI?
<andrewrk> ah yes emekankurumeh[m] just pointed that out
<andrewrk> emekankurumeh[m], you have become increasingly helpful and knowledgable in general. it's been really cool to watch
<mikdusan1> andrewrk: llvm-ir for copy-elision-3 vs. master -- i am thinking line 33 (ce3) vs. 38 (master)
<emekankurumeh[m]> it's been really cool to see zig grow as a language as well
<scientes> yes
a_chou has joined #zig
<IntoxicatedHippo> Assuming I used that correctly, it didn't fix it: https://github.com/liampwll/zig-efi-os/commit/f9213c4f0e24c2b28760204d165026f510d56831
<andrewrk> mikdusan1, yes this looks incorrect. in ce3 code, %result_array = alloca [4 x i32], align 4
<IntoxicatedHippo> the new linker command is the one zig uses
<andrewrk> that's align 4. then it gets casted and used with store <4 x i32> %11, <4 x i32>* %12, !dbg !11167
<andrewrk> which assumes ABI align of vectors which is 16
a_chou has quit [Client Quit]
<mikdusan1> ok just to confirm i grok, because llvm.memcpy was explicit align 4, it was ok. but now that store is used with implicit ABI, the stack slot has to be attributed align 16 to be correct
<andrewrk> mikdusan1, I think this is a "missing feature" in the ce3 branch because when it does the result location cast, it needs to deal with the alignment. I think I know what's happening here
<andrewrk> that's correct
<andrewrk> either you have to align the thing more, or annotate that the load/store is under-aligned
<andrewrk> I believe master works because there is an intermediate value with the larger alignment
<andrewrk> IntoxicatedHippo, maybe I can use this as the live coding topic on thursday if you don't figure it out by then
<andrewrk> (I don't have a solution; I would be troubleshooting it)
<IntoxicatedHippo> I've just realised I'm not using the efi file generated by the new command... but now I'm getting a gp fault somewhere between calling real_main and the first print
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<IntoxicatedHippo> It only prints "before real_main"
<fu5ha> ok here's a trivial reconstruction, not sure what these errors mean/what's causing them https://godbolt.org/z/vYSKus
<andrewrk> fu5ha, this appears to be a bug
<fu5ha> ok so I just switched everything to being [4]f32 and it works again
<fu5ha> so I guess there's something special about 3 that's making it not be happy :p
<andrewrk> IntoxicatedHippo, @setStackAlign doesn't do anything at runtime
<andrewrk> those print statements may as well be next to each other
<andrewrk> it makes it so that the call to real_main will align the stack before calling
<andrewrk> IntoxicatedHippo, ohh you might want this workaround too
<andrewrk> oh wait, that's for posix
<andrewrk> well it's worth a try
<fu5ha> I'll file a bug for that real fast... another quick question, is there a way to implement functions that would get me 'method syntax' on non-struct types, like directly on a [4]f32 for example?
<andrewrk> IntoxicatedHippo, ignoring the @noInlineCall thing, what happens if you put @setAlignStack in your efi_main and make it a normal extern fn?
<andrewrk> why nakedcc?
<andrewrk> fu5ha, why does the struct have to be packed? it works if I don't make it packed
<andrewrk> (it's still a bug though)
<emekankurumeh[m]> fu5ha: no zig doesn't have anything like ufcs
<andrewrk> fu5ha, even if the struct is not packed, the array will still be contiguous
<andrewrk> I'd recommend non-packed for your vec3 struct
<fu5ha> andrewrk it probably doesn't for now, though the idea is to make it directly interoperable with opengl/vulkan
<andrewrk> the `data: [3]f32` alone will accomplish that
<fu5ha> though as you say it should be fien since I'm using actual float arrays
<fu5ha> fine*
<fu5ha> I'll do not packed for now, thanks :D
<gamester> V source code has been released. It's a few thousand lines of code. The doom translation? One file so far.
<IntoxicatedHippo> andrewrk, that fixes it, I can't remember why I had nakedCC
<Tetralux> Is there any circumstance where you _can_ do a normal call from inside a nakedcc fn? If not, maybe it should be an error unless you use @noInlineCall.
<andrewrk> IntoxicatedHippo, glad you got it working
<andrewrk> IntoxicatedHippo, let me know if there's some reason you can't use zig build-exe and you have to use a separate lld, that's not supposed to be necessary
<IntoxicatedHippo> Zig needs to invoke lld-link instead of lld and it needs to add /SUBSYSTEM:efi_application to the command
<andrewrk> use the --subsystem efi_application CLI arg
<andrewrk> lld-link is the same thing as lld, it's just the "windows driver" which zig knows to choose based on the target
<andrewrk> the reason zig couldn't infer the subsystem arg is because there are other choices for the same target: efi_boot_service_driver, efi_rom, efi_runtime_driver
<IntoxicatedHippo> It was telling me to use lld-link instead of lld, but setting the subsystem fixes that
<andrewrk> hmm sounds like zig should detect that and add a more helpful error
<andrewrk> "subsystem arg mandatory for uefi target" something like that
<IntoxicatedHippo> New problem: debug builds won't run. I assume they need some sort of runtime support?
<IntoxicatedHippo> Nevermind, it was valgrind stuff breaking it
<IntoxicatedHippo> nevermind^2, it's still broken
<emekankurumeh[m]> Tetralux: yes you can use `@newStackCall`
<Tetralux> emekankurumeh[m], So @noInlineCall and @newStackCall are the only two ways to call stuff inside nakedcc unless you use asm to set it up yourself? Something like that?
<scientes> Tetralux, as long as you advance the stack pointer it would be fine
<emekankurumeh[m]> i don't think @noInlineCall should unless you already have a stack set up
<scientes> oh I see, yeah @noInlineCall
<emekankurumeh[m]> i think there is a proposal for a builtin for calling functions but i can't find it right now
<scientes> maybe zig should just automatically set that on nakedcc functions?
<scientes> emekankurumeh[m], you mean calling conventions, yes
<emekankurumeh[m]> no i mean a builtin like @funcCall(fun, args...)
<scientes> we already have that, its called @field()
<scientes> and every function is also a function pointer in a namespace
<Tetralux> I'm just thinking that if there's only a few valid ways to call a function from nakedcc, it's probably better to have a compile error that tells you what you need to do than it is to be scratching your head.
<scientes> Tetralux, no, zig should just set the noinline attribute automatically, and then its on you to protect stack variables
<scientes> but if you don't use the stack then it will work fine
<Tetralux> Can you elaborate on 'protect'?
<scientes> if you write to the stack then you have to advance the stack pointer
<scientes> and zig variables would work too
<scientes> but if you use assembly of course you are on your own
<scientes> i'm not sure why we have nakedcc actually......how does it differ from a function with no arguments?
<scientes> that is extern
<Tetralux> Just as if it's an memory arena; and if you don't advance it, the next stack var would overwrite it - i.e: if you have a stack var inside nakedcc, advance the stack pointer enough before calling a fn?
<scientes> yeah
<Tetralux> Okay. Makes sense.
<Tetralux> You'd do the advancing with asm?
<scientes> that is the only way
<Tetralux> I figured.
<Tetralux> Okay ta.
<scientes> as zig doesn't have @alloca() anymore
<Tetralux> I'm guessing the logic was "If you're using nakedcc, you know what asm advances the stack if you need to."
<Tetralux> And I'd also be interested to know what makes nakedcc different from extern fn().
<scientes> yeah I don't think there is much difference
<Tetralux> Never dabbled with any of that stuff.
<scientes> cause you still have to declare the type signature elsewhere in order for the calling conventions to work
<emekankurumeh[m]> doesn't nakedcc mean no function prologue or epilogue?
<scientes> yes it does
<scientes> there must be a llvm feature that this is tied to
<emekankurumeh[m]> don't extern functions have prologues and epilogues then?
<emekankurumeh[m]> so how are they the same?
<andrewrk> IntoxicatedHippo, what's happening with debug builds?
<andrewrk> i'll modify the logic to disable valgrind for that target
<scientes> emekankurumeh[m], yeah but zig doesn't have code like that
wilsonk has quit [Ping timeout: 258 seconds]
<scientes> so i'm wondering where the llvm feature docs are
<andrewrk> IntoxicatedHippo, looks to me like valgrind stuff is disabled for that target by default: https://github.com/ziglang/zig/blob/987c209b407f8379fd58381dcd3975982dfccdaf/src/target.cpp#L1333-L1344
<scientes> naked
<scientes> This attribute disables prologue / epilogue emission for the function. This can have very system-specific consequences.
<emekankurumeh[m]> what do you mean by that? zig doesn't update the stack pointer or insert `ret` instructions for extern functions?
IntoxicatedHippo has quit [Ping timeout: 258 seconds]
<scientes> emekankurumeh[m], that was a paste from https://llvm.org/docs/LangRef.html
<emekankurumeh[m]> i know, i just don't understand what you mean by "zig doesn't have code like that"
<scientes> emekankurumeh[m], zig have very little target-specific code
<scientes> that's what I meant
<scientes> so i knew there had to be a llvm feature
<emekankurumeh[m]> but llvm will insert that code regardless
<emekankurumeh[m]> i'm waiting for it to be added to the benchmarks here: https://github.com/mjansson/rpmalloc
<fu5ha> i find the graphs they have in the mimalloc repo obtusely hard to read lol
<scientes> yeah they are pretty bad
<scientes> especially as they use abbreviations in the legend
<scientes> why can't we just use a C general purpose allocator?
<scientes> for our general purpose allocator
<emekankurumeh[m]> you don't always want to link to libc
<scientes> oh yes of course
<scientes> but maybe it would be possible to remove that dependancy
<scientes> not all c programs require libc
<emekankurumeh[m]> plus the system c allocator isn't always the best for all situations, i.e. highly concurrent programs
<scientes> i'm not talking about the system allocator
<scientes> i'm talking about using code written in C in zig
<scientes> but i guess that isn't really that important yet
<emekankurumeh[m]> oh i see what you mean
fu5ha has quit [Remote host closed the connection]
<andrewrk> scientes, the wip general purpose allocator I have takes advantage of zig std lib stuff, such as collecting stack traces
<andrewrk> and does comptime logic based on std.mem.page_size
<andrewrk> and has comptime-configurable options
<scientes> cool
jjido has joined #zig
<curtisf> What's the reason for disallowing runtime `continue` in `inline for` loops? ( https://github.com/ziglang/zig/issues/834 )
<andrewrk> curtisf, `continue` in an inline loop is defined to go to the next iteration of the loop right? but it's inlined so it has to do that goto at comptime. but in this example the `continue` is inside a branch that is only known if it's taken at runtime
<andrewrk> you can't unroll a loop if you have a `continue` that the compiler doesn't know will get executed until runtime
<andrewrk> I'm proud of that error message, I think it's quite helpful
<curtisf> I don't follow. What prevents a runtime goto in the `if` in each unrolled iteration?
<scientes> just nest another block if you need that
<scientes> otherwise sure it could be allowed when there is no continue statement
<scientes> *no continue block
<redj> very nice andrewrk :)
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<curtisf> scientes: do you mean do it like this? https://gist.github.com/CurtisFenner/30f2c0aa76cfd23a4119603c81e31609
<scientes> yes
<curtisf> that's unfortunate
<scientes> except you used "break;" where you meant "continue;"
<curtisf> ?
<scientes> oh that wont work
<andrewrk> doesn't it make sense? if you unroll a loop, your loop control flow has to be comptime
<scientes> curtisf, just put the warn inside a if()
<curtisf> scientes: the real code that is prompting this pattern wants to `continue` in one of the error cases in a select, where that isn't an option
<scientes> andrewrk, actually continue and break could be supported, the trick is knowing how many times the loop executes if there is no break
<curtisf> To me, unrolling a loop over a comptime array should just mean duplicating the array body in sequence, with the indices and elements bound. I don't see why skipping to the end of a particular iteration would be outlawed
<curtisf> Maybe `break` is different from `continue`, but since the control flow of `continue` is entirely within one iteration it seems like it should be allowed
<andrewrk> curtisf, I see, maybe that can work
<andrewrk> make a proposal
<curtisf> Okay
<andrewrk> sorry let me rephrase: a proposal would be welcome
fu5ha has joined #zig
curtisf has quit [Ping timeout: 256 seconds]
fu5ha has quit [Remote host closed the connection]
<andrewrk> mikdusan1, found another example of code that had to be changed for new semantics
<Tetralux> Are the new semantics suitably summed up by saying that now, if you want to make a value copy of a stack variable, you have to do it explicitly?
<Tetralux> Is that a fair summation?
<Tetralux> Also - will that the example you just linked would be an error in the future?
wilsonk has joined #zig
ace-_ has joined #zig
<andrewrk> yes that is a fair summation
<andrewrk> the aliasing proposal would cover it
<andrewrk> but that's very researchy
<andrewrk> note that it's also possible to walk back this stack variable copying thing without compromising the rest of this result location stuff
<andrewrk> it's actually a separate thing that I accidentally did at the same time
<Tetralux> I gotcha
curtisf has joined #zig
<curtisf> I'm getting real confused. How do I initialize a value of a tagged-union type if I know the name of the field?
presiden has joined #zig
<andrewrk> curtisf, overwrite the whole value
<andrewrk> there should be an example here: https://ziglang.org/documentation/master/#union
<andrewrk> yeah it's mentioned
<andrewrk> if you want to activate another tag without having a value yet, use undefined
<andrewrk> if you think about it, this matches variable initialization, where you have to explicitly say something is undefined
<curtisf> I mean the name is a `comptime []const u8`. I tried ```var choice: Into = undefined; @field(choice, field.name) = field_value;``` but I get a runtime error ("access of inactive union field")
<andrewrk> ahhh sorry there's an issue for this and an open PR to solve it
<andrewrk> I haven't reviewed the PR yet
<curtisf> ah, thanks, so I wasn't missing something!
<curtisf> in the meantime, does there happen to be any "hacky" way to do this like blocking the safety check?