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/
<tgschultz> shritesh, I don't think `for` recognizes null at all. `while` does, but I don't think it would work on a null terminated slice, it's more for iterators.
<shritesh> tgschultz: Yeah. I used an if inside the for to deal with that
return0e_ has quit [Ping timeout: 245 seconds]
return0e has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
<tgschultz> hmmm, interesting. It appears impossible to pass an empty struct instance to a varargs fn. It ends up having type `void`
<tgschultz> ...kinda. @typeOf(args[index]) is correct, but if you try to assign it it becomes void.
marmotini_ has joined #zig
scientes has quit [Ping timeout: 258 seconds]
marmotini_ has quit [Ping timeout: 258 seconds]
<emekankurumeh[m]> i thought the empty struct is how "instantiate" void
<emekankurumeh[m]> for example with tagged unions with no a void payload you have to do Union { .VoidField = {} }
<tgschultz> `@typeOf({}) == void` but `struct{} != void`.
<tgschultz> in fact, `struct{} != struct{}`
<tgschultz> each `struct{}` is a unique type.
<tgschultz> normally given `const Empty = struct{};` `@typeOf(Empty(undefined)) == Empty`. The issue is, if you pass `Empty(undefined)` to a varargs and try to assign it to a var of type Empty, it is suddenly of type `void`. See the test in #2393
<mikdusan> looks like the type is lost. if you simply add a field to the struct, it's type is retained in var args fn
<tgschultz> but the type isn't lost. if you do @typeOf(args[0]) it will be correct.
<tgschultz> but when you assign it, it's void.
<tgschultz> its weird, but irrelevant really since varargs are going away.
<tgschultz> huh, ok, I stand corrected. I could have sworn it didn't when I tried it.
marmotini_ has joined #zig
<shritesh> andrewrk: How can I add wasi to `test_std`? I want to implement the APIs that make sense and make sure they compile during CI.
<andrewrk> daurnimator, so it begins: https://github.com/ziglang/zig/compare/copy-elision-3
<andrewrk> mikdusan, yes that's still a goal. it makes the binary downloads more reliable
<andrewrk> shritesh, the null pointer thing will get better after https://github.com/ziglang/zig/issues/265
<andrewrk> shritesh, to test wasi with the std lib tests we need a wasi interpreter - that's why I keep mentioning it
<andrewrk> I'd like to avoid a dependency on wasmer or the other one for the zig test suite
<daurnimator> andrewrk: hrm. idea from reading that diff: is there a way to go from<>to a function signature to a struct?
<andrewrk> daurnimator, I'm lost. what?
<daurnimator> andrewrk: uh, lost on what?
SimonNa has quit [Remote host closed the connection]
<daurnimator> andrewrk: It's related to calling arbitrary functions: e.g. something like `@call(myfunc, @argsType(myfunc){.a=1, .b=myslice})` to call a function `fn myfunc(a: u32, b: []u8) sometype;`
SimonNa has joined #zig
<andrewrk> daurnimator, are you talking about C++ or Zig?
<daurnimator> andrewrk: sorry; it's a bit of a tangent. I was meaning that many of the functions that got changes as part of that diff are ones I feel like such a @call function might need to change too
tiehuis has joined #zig
<tiehuis> Updated the vscode zig extension to 0.2.0 if you are using that
<tiehuis> sorry it took so long!
<andrewrk> nice!
<tiehuis> vscode wasn't working locally for me for a while which added to the delay
<tiehuis> well, debugging extensions, that is
tiehuis has quit [Client Quit]
ltriant has quit [Quit: leaving]
bheads_____ has joined #zig
bheads____ has quit [Read error: Connection reset by peer]
marmotini has joined #zig
qazo has quit [Ping timeout: 258 seconds]
very-mediocre has joined #zig
marmotini_ has quit [Quit: Leaving]
slugm has joined #zig
_whitelogger has joined #zig
qazo has joined #zig
wootehfoot has joined #zig
Sahnvour has joined #zig
very-mediocre has quit [Ping timeout: 256 seconds]
marmotini has quit [Ping timeout: 258 seconds]
scientes has joined #zig
shritesh has quit [Quit: Segmentation Fault]
marmotini_ has joined #zig
<bketelsen> tiehuis: Thanks for the vs code extension!
Sahnvour_ has joined #zig
Sahnvour has quit [Read error: Connection reset by peer]
shritesh has joined #zig
Sahnvour has joined #zig
Sahnvour_ has quit [Ping timeout: 255 seconds]
shritesh has quit [Quit: shritesh]
purelazy has joined #zig
<Sahnvour> andrewrk, I think I have a reduced example for https://github.com/ziglang/zig/issues/2375, including equivalent c++ ones, but I don't know what to do for a pure LLVM IR one
<Sahnvour> but from what I can tell so far, it seems indeed a behaviour of LLVM rather than zig
halosghost has joined #zig
slugm has quit [Remote host closed the connection]
slugm has joined #zig
andrewrk has quit [Ping timeout: 240 seconds]
andrewrk has joined #zig
return0e_ has joined #zig
return0e has quit [Ping timeout: 244 seconds]
shritesh has joined #zig
return0e has joined #zig
return0e_ has quit [Ping timeout: 245 seconds]
wootehfoot has quit [Read error: Connection reset by peer]
qazo has quit [Ping timeout: 244 seconds]
slugm has quit [Read error: Connection reset by peer]
slugm has joined #zig
shritesh has quit [Quit: Segmentation Fault]
meheleventyone has joined #zig
shritesh has joined #zig
shritesh has quit [Read error: Connection reset by peer]
shritesh_ has joined #zig
hio has quit [Quit: Connection closed for inactivity]
jjido has joined #zig
meheleventyone has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
qazo has joined #zig
hio has joined #zig
porky11 has joined #zig
shritesh_ has quit [Quit: Segmentation Fault]
<adrusi_> What is the error set for creating a promise?
<adrusi_> @compileLog(@typeOf(async<std.debug.global_allocator> foo())); gives "std.mem.Error", but there is no std.mem.Error.
adrusi_ is now known as adrusi
<andrewrk> adrusi_, I'm about to rip out all that code and change the way it works
<adrusi> yeah I guess, I'm watching the issue thread for the rewrite
<adrusi> I'm curious what's going on with the current implementation though. How is it returning an error set that doesn't exist?
<tgschultz> fascinating. I've triggered an assert with comptime using only a perfectly valid function call in an extern union. If I change it to a non-extern union the compiler is happy.
<andrewrk> adrusi, it's supposed to be the error set of the allocator
<tgschultz> andrewrk, adrusi, I think I saw that same thing on a completely non-async function.
<tgschultz> the std.mem.Error being reported as the ErrorSet I mean.
wilsonk has quit [Ping timeout: 246 seconds]
wilsonk has joined #zig
<adrusi> Yeah I'm pretty confused about how async functions interface with the type system. I understand they're all implictly generic but I'm still wrapping my head around what that means.
<adrusi> the type of "fn bar() !void { _ = try async<std.debug.global_allocator> foo(); }" is reported as "fn() @typeOf(bar).ReturnType.ErrorSet!void"
<adrusi> "@compileLog(std.mem.Allocator.Error);" prints "std.mem.Error". That seems like a bug.
purelazy has quit [Quit: Page closed]
<tgschultz> I'd say so yes.
<tgschultz> ok, this compiler crash (not an assert, no message) seems to be due to creating an extern union with a single void field.
<tgschultz> hmm... it's more complicated than that though.
<tgschultz> weird, it seems related to calling std.mem.eql, not on the 0-sized union but on a definition in its namespace.
slugm has quit [Remote host closed the connection]
slugm has joined #zig
hio has quit []
<tgschultz> bug has nothing to do with comptime. issue incoming.
<tgschultz> #2401
<andrewrk> thanks
slugm has quit [Ping timeout: 276 seconds]
fengb has joined #zig
<fengb> Is there a way to make bitwise array types? I'd like to do 4 elements of 4 bits
jjido has joined #zig
<andrewrk> currently no
<halosghost> oh, really? so it's not possible to have an []i4?
<andrewrk> it's possible but @sizeOf(i4) == 1
<andrewrk> each element is 1 byte
<emekankurumeh[m]> are the values packed?
<halosghost> andrewrk: ahh, I see
<fengb> Is it feasible to support it? I'm assuming there's potentially weird edge cases
<halosghost> that makes sense really
<halosghost> yet another reason I wish I had a 1-bit-byte machine
<andrewrk> emekankurumeh[m], zig does not currently have packed arrays
<companion_cube> does any language have such a feature?
<andrewrk> fengb, it's not out of the question
<companion_cube> (to me it sounds like it could be done in a library, like bitvectors usually are)
<fengb> I haven't seen it done in a language but it'd be more natural to do `a[3]` instead of `a >>(4 * 3) & 0b1111` or even `a.get(3)`
porky11 has quit [Quit: Leaving]
halosghost has quit [Quit: WeeChat 2.4]
<tgschultz> it shouldn't be tremendously difficult to create a PackedArray type in userland. Bit(In/Out)Stream should get you a good chunk of the way there.
marmotini_ has quit [Ping timeout: 250 seconds]
mindfv has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mindfv has quit [Remote host closed the connection]
<hryx> andrewrk: since the recursive parser is almost ready, I'm thinking about opening a draft PR for visibility. Helpful, or would that just create a crap ton of email spam for you? There will definitely be more commits this week
<andrewrk> hryx, feel free to do that - no complaints on my end
* scientes has experience with e-mail spam against andrew...
<hryx> great!
<andrewrk> scientes, I think that if you look closely at https://github.com/ziglang/zig/pull/2171#issuecomment-487674824 you will see that my complaints are less to do with volume and more to do with other factors
bheads______ has joined #zig
<scientes> OK, it will improove
<andrewrk> here is an example of hryx making things easier on me: https://github.com/ziglang/zig/issues/2196
bheads_____ has quit [Ping timeout: 250 seconds]
<andrewrk> you can see how that would have been more difficult to handle appropriately if it were a pull request with no description
fengb has quit [Quit: Page closed]
Sahnvour has quit [Read error: Connection reset by peer]
ltriant has joined #zig