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/
<ronsor> that sounds like something Microsoft does
<torque> it's very wacky
<shakesoda> the perils of people writing broken version checks that need accommodations
<shakesoda> i can only imagine the situation for that was pretty bad if even apple had to mind the compatibility of it
<fengb> I don’t understand a world with 11 in it
traviss has quit [Remote host closed the connection]
cole-h has quit [Quit: Goodbye]
cole-h has joined #zig
traviss has joined #zig
cole-h has quit [Quit: Goodbye]
cole-h has joined #zig
rzezeski has quit [Quit: Connection closed for inactivity]
nephele_ has joined #zig
nephele has quit [Ping timeout: 240 seconds]
nephele_ is now known as nephele
rzezeski has joined #zig
<andrewrk> pow(2, log(base, string_len))
<andrewrk> I need an approximation (upper bound) of this equation using only integer operations
* andrewrk puts on his math hat
ur5us has quit [Ping timeout: 240 seconds]
<andrewrk> hmm my equation is wrong
ur5us has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
craigo has joined #zig
bsrd has quit [Read error: Connection reset by peer]
bsrd has joined #zig
cole-h has quit [Ping timeout: 258 seconds]
cole-h has joined #zig
ur5us has quit [Ping timeout: 244 seconds]
PC9801 has quit [Ping timeout: 258 seconds]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
<andrewrk> for the record, never mind that, here was the answer: https://github.com/ziglang/zig/issues/6167#issuecomment-680456728
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
<protheory8-new-m> How do I start an async function from `main`?
<alexnask[m]> If you are using `pub const io_mode = .evented;` you can just call async functions from main without issues
<alexnask[m]> Otherwise you would have to do some manual work since main will be a "seam" between sync and async calls
<andrewrk> yeah that's right. to summarize: you can use the std lib event loop, or you can write your own
<alexnask[m]> (actually, you could call an async function but could not suspend or resume from main)
<alexnask[m]> or await**
<protheory8-new-m> Well I would like to try doing that manual work I guess
<andrewrk> if you don't mind video format, this is probably going to be helpful to you: https://www.youtube.com/watch?v=zeLToGnjIUM
* shakesoda wishes youtube would outright provide transcripts for everything
<alexnask[m]> (just keep in mind `noasync` is `nosuspend` now :) )
<andrewrk> alexnask[m], that changed approximately 1 day after the video was recorded xD
* pixelherodev wishes more videos were on e.g. peertube instead of youtube :P
<andrewrk> I'd look into hosting my streams there if someone else wanted to provide the hosting
<protheory8-new-m> andrewrk: thanks, why is changing threads required though?
<andrewrk> protheory8-new-m, what makes you think it's required?
<andrewrk> (sincere question)
<protheory8-new-m> to wait on it?
<daurnimator> andrewrk: I don't think the event loop implementation is really swappable right now
<andrewrk> protheory8-new-m, resuming in a new thread is just one example. it could have called resume in any thread
<andrewrk> daurnimator, agreed
<andrewrk> we'll get there
<daurnimator> oh I know. just saying I don't think its doable right now without some changes to the std lib
<pixelherodev> andrewrk: I've been using diode.zone for now, though I plan on self-hosting eventually
<andrewrk> GAH big spooky spider just crawled across the wall next to me
<Nypsie[m]> Burn it
<ikskuh> befriend it, let it build a web and let it sit on your keyboard, so it can eat all the bugs in zig as soon as they appear
<pixelherodev> The wall?!
<pixelherodev> Don't burn the wall!
<pixelherodev> You need that!
<ikskuh> walls are optional
<alexnask[m]> daurnimator: Loris had a PR with some initial changes to make the API the loop needs to expose a bit better
<pixelherodev> Why does matrix do that? Ugh
<pixelherodev> Hard to copy URLs from tmux+weechat
<andrewrk> protheory8-new-m, I'm not sure what you're trying to demonstrate here - can you be more specific with your question?
<protheory8-new-m> I'm trying to figure out how to launch async function from main, so I wonder if the code snippet that I sent is actually corrent
<protheory8-new-m> probably not
<ikskuh> protheory8-new-m: i think you're trying to understand "async" as "async spawns a thread, will be joined on await"
<protheory8-new-m> Well I know that async function kinda returns back to callsite when `suspend` is reached and then it goes back when resuming if I understand correctly.
<protheory8-new-m> ikskuh: not really I guess
decentpenguin has quit [Ping timeout: 256 seconds]
<ikskuh> protheory8-new-m: okay good, just making sure ;)
cole-h has quit [Quit: Goodbye]
<andrewrk> to understand async/await in zig, one must actually learn how the memory layout of async functions works. it is a little bit of investment, but it is worth it because you will have full knowledge of what you can and cannot do
<ikskuh> daurnimator: where did you find that `..` is a valid file/path name on windows?
kushalp has quit [Ping timeout: 244 seconds]
karrick has quit [Ping timeout: 265 seconds]
tracernz has quit [Write error: Connection reset by peer]
procnto has quit [Read error: Connection reset by peer]
kwilczynski has quit [Ping timeout: 260 seconds]
r0bby has quit [Ping timeout: 272 seconds]
procnto has joined #zig
rzezeski has quit [Ping timeout: 244 seconds]
<daurnimator> ikskuh: I recall it from somewhere. try with NtCreateFile?
<ikskuh> documentation tells me that ".." is supposed the upper directory
<ikskuh> maybe you discovered a bug? :D
kwilczynski has joined #zig
<daurnimator> ikskuh: thats done in userspace in win32
karrick has joined #zig
r0bby has joined #zig
kushalp has joined #zig
BoilerOnAsurf has joined #zig
tracernz has joined #zig
rzezeski has joined #zig
<andrewrk> sounds like we should do it in userspace in zig std lib? unless there's some reason to try to support that
<daurnimator> andrewrk: yes.
<ikskuh> current state is at least annoying, breaking pretty much all of my projects on windows :D
<daurnimator> andrewrk: I think we might need a 'Path' type that could be e.g. `union (enum) { posix: []const u8, win32: []const u16, nt: []const u16}`
<andrewrk> I'm not saying you're wrong necessarily, but that looks like something nightmarish
<ikskuh> daurnimator: proper path type is probably more a []const []const T
<andrewrk> isn't WTF-8 suitable for all platforms?
<daurnimator> andrewrk: it does ends up in needless conversions back and forth
<daurnimator> and we have an explosion of {open,move,etc}File{Z,W,blah}
<daurnimator> ikskuh: I don't know about that....
<protheory8-new-m> How do I init a C struct with default values in Zig?
BoilerOnAsurf has quit [Remote host closed the connection]
gpanders[m] has quit [Quit: Idle for 30+ days]
<daurnimator> protheory8-new-m: what default values?
<protheory8-new-m> I'm interested in `StructName instance;` line
<alexnask[m]> `var instance: StructName = undefined;`
ur5us has joined #zig
<alexnask[m]> Yes, as long as `instance` is `var ` and not `const`
<protheory8-new-m> Thanks
<alexnask[m]> Depending on what the C code does there may be a better way to translate it than leaving the value undefined btw, but this is the direct translation :)
<daurnimator> protheory8-new-m: C doesn't have default values.... so I don't think you're asking the question you think you are
<daurnimator> for static storage things do get initialised to 0 in C...
<alexnask[m]> For example, if the C uses an if/else and initializes with different values in each branch, you can just use an if/else expression (`var instance: StructName = if (...) .{ .x = 0, .y = 0 } else .{ .x = 255, .y = 255 }`)
pangey has quit [Ping timeout: 240 seconds]
pangey has joined #zig
_Vi has joined #zig
st4ll1 has joined #zig
BoilerOnAsurf has joined #zig
st4ll1 has quit [Quit: WeeChat 2.9]
rzezeski has quit [Quit: Connection closed for inactivity]
BoilerOnAsurf has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 240 seconds]
s-ol has joined #zig
_Vi has quit [Ping timeout: 246 seconds]
jmiven has quit [Quit: bye]
jmiven has joined #zig
st4ll1 has joined #zig
nycex has quit [Remote host closed the connection]
nycex has joined #zig
craigo_ has joined #zig
andrewrk has quit [Excess Flood]
craigo has quit [Ping timeout: 260 seconds]
andrewrk has joined #zig
st4ll1 has quit [Ping timeout: 240 seconds]
st4ll1 has joined #zig
waleee-cl has joined #zig
sawzall has quit [Read error: Connection reset by peer]
sawzall has joined #zig
_Vi has joined #zig
rzezeski has joined #zig
<fengb> I've noticed that std.debug.panic isn't connected to `@import("root").panic`
<scientes> fengb, I think it goes through a C symbol, right?
<fengb> No, it triggers panicExtra directly
<fengb> Which is what start.zig's default_panic triggers as well
<fengb> But... shouldn't it go through the root panic? This is the only way in std to use a format string panic
Akuli has joined #zig
<scientes> I only know that if you add a panic in the root you can get rid of all that ugly codegen
jorangreef has joined #zig
<ikskuh> root panic is called by @panic afaik
<ikskuh> std.debug.panic calls std.debug.panicExtra which calls @panic
<scientes> yeah, that was my understanding (but I never read the code)
<jorangreef> Hey everyone, I am new to Zig. What is the safest way to zero the memory of an extern struct? @memset(@ptrCast([*]align(8) u8, struct_ptr), 0, @sizeOf(@TypeOf(struct)));
<BaroqueLarouche> std.mem.zeroes
<jorangreef> I tried: struct_ptr.* = {} but one needs to specify all fields.
<fengb> Nope, panicExtra directly exits
<fengb> @panic calls default_panic which calls panicExtra
<fengb> Which feels backwards
<fengb> I'll create a new issue
<jorangreef> Thanks BaroqueLarouche
dead10cc has joined #zig
nikita` is now known as ronja`
ronja` is now known as nikita`
dead10cc has quit [Quit: Konversation terminated!]
traviss_ has joined #zig
traviss has quit [Ping timeout: 260 seconds]
jorangreef has quit [Remote host closed the connection]
craigo_ has quit [Ping timeout: 246 seconds]
joey152 has joined #zig
<protheory8-new-m> How do I ignore returned error?
<Nypsie[m]> You can't
<Nypsie[m]> Well, I suppose you could do myErrorSetFunction() catch {}
<protheory8-new-m> What's the difference between `Fn` and `BoundFn` in `std.builtin.TypeInfo`?
<alexnask[m]> BoundFns are expressions like `foo.bar` where `@TypeOf(foo)` has a `bar` function with a self parameter
wootehfoot has joined #zig
cole-h has joined #zig
st4ll1 has quit [Ping timeout: 265 seconds]
st4ll1 has joined #zig
wootehfoot has quit [Ping timeout: 240 seconds]
marnix has joined #zig
nvmd has joined #zig
marnix has quit [Ping timeout: 256 seconds]
heitzmann has quit [Quit: WeeChat 2.9]
heitzmann has joined #zig
ur5us has joined #zig
Akuli has quit [Quit: Leaving]
cole-h has quit [Quit: Goodbye]
_Vi has quit [Ping timeout: 246 seconds]
xackus has joined #zig
xackus has quit [Quit: Leaving]
tdeo has quit [Ping timeout: 260 seconds]
nvmd has quit [Quit: Later nerds.]
tdeo has joined #zig
craigo_ has joined #zig