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/
<andrewrk> certainly there are codepaths where cleanup is hard to test, but for a lot of compiler tasks it's embarassingly testable
<ifreund> Yeah, I saw that :)
<ifreund> Someday when I have time I should try and set up something similar for river/wlroots
<ifreund> wlroots is one of the C libraries that at least trys to care about allocation failure :)
ur5us_ has joined #zig
nycex has quit [Remote host closed the connection]
zags has quit [Ping timeout: 265 seconds]
nycex has joined #zig
kchambers has quit [Quit: WeeChat 3.0]
brzg has joined #zig
xackus__ has joined #zig
semarie has quit [Ping timeout: 258 seconds]
semarie has joined #zig
gazler_ has joined #zig
gazler has quit [Ping timeout: 256 seconds]
<v0idify> if i have a thing that's `?c.a_c_type` how do i point to the inner non-null value? a bit confusing
<brzg> the point of `?` is that it's not definite that there's an inner non-null value
<brzg> so you'd need to use `thing orselse ...` or `thing.?` or `if (thing) |inner| { ... }`
<v0idify> well, I want to un-null it and pass it to a C function to initialize it
<brzg> if you're looking to get a *c.a_c_type
<v0idify> that
<brzg> `if (thing) |*inner| { ... }`
<v0idify> yeah but !thing, it's null
<v0idify> it starts off null and I want a pointer to init it
<brzg> why do you need a pointer to initalise it but can't make it nonnull
<v0idify> ?
<brzg> if you need a pointer to initalise it, you need to have it be nonnull
<v0idify> the context is that I have a variable that contains c.FT_Library and it is lazily initialized when it's needed
<v0idify> if i set the variable to undefined, would it be non-null and therefore allow a pointer?
<brzg> it would be undefined and therefore you shouldn't rely on its value
<v0idify> if (!thing) { thing = undefined; c.init(&thing.?); }
<mikdusan> `var thing: ?c.FT_Library = null; var p = &thing; p.* = some_value;`
<v0idify> but that's a pointer to the Optional
<brzg> ah, another idea: make a variable of type `c.a_c_type`, pass its pointer to the c function, then transfer the initialised value into the `?c.a_c_type` variable
<v0idify> ooh that could wokr
<v0idify> kinda annoying but that'll do for now
brzg has quit [Quit: leaving]
ur5us has joined #zig
ur5us_ has quit [Ping timeout: 260 seconds]
SimonNa has quit [Ping timeout: 260 seconds]
SimonNa has joined #zig
swills has quit [Ping timeout: 260 seconds]
osa1_ has joined #zig
osa1 has quit [Ping timeout: 265 seconds]
swills has joined #zig
semarie has quit [Ping timeout: 272 seconds]
drawkula has joined #zig
semarie has joined #zig
yeti has quit [Ping timeout: 240 seconds]
jukan has joined #zig
jukan_ has quit [Ping timeout: 264 seconds]
drawkula is now known as yeti
xackus__ has quit [Ping timeout: 240 seconds]
euantorano has quit [Read error: Connection reset by peer]
waleee-cl has quit [Read error: Connection reset by peer]
jzelinskie has quit [Read error: Connection reset by peer]
shurane has quit [Read error: Connection reset by peer]
ovf has quit [Read error: Connection reset by peer]
hnOsmium0001 has quit [Ping timeout: 258 seconds]
larme has quit [Ping timeout: 272 seconds]
shurane has joined #zig
euantorano has joined #zig
larme has joined #zig
dyeplexer has joined #zig
jzelinskie has joined #zig
waleee-cl has joined #zig
ovf has joined #zig
hnOsmium0001 has joined #zig
remby has joined #zig
ur5us has quit [Ping timeout: 264 seconds]
_whitelogger has joined #zig
_fritchie has quit [Remote host closed the connection]
_fritchie has joined #zig
remby has quit [Quit: Connection closed]
remby has joined #zig
remby has quit [Quit: Connection closed]
edr has quit [Ping timeout: 260 seconds]
geemili has quit [Ping timeout: 264 seconds]
sord937 has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
tnorth_ has joined #zig
SebastianM has joined #zig
osa1_ is now known as osa1
SebastianM has quit [Quit: -a- IRC for Android 2.1.59]
gazler_ has quit [Remote host closed the connection]
SebastianM has joined #zig
SebastianM has quit [Quit: -a- IRC for Android 2.1.59]
ur5us has joined #zig
tnorth_ has quit [Quit: Konversation terminated!]
BaroqueLarouche has quit [Quit: Idle for 30+ days]
ur5us has quit [Ping timeout: 264 seconds]
jokoon has joined #zig
SebastianM has joined #zig
cole-h has quit [Ping timeout: 256 seconds]
zags has joined #zig
SebastianM has quit [Quit: -a- IRC for Android 2.1.59]
WilhelmVonWeiner has quit [Ping timeout: 246 seconds]
gazler has joined #zig
p_____ has joined #zig
dyeplexer has quit [Ping timeout: 256 seconds]
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
<ifreund> v0idify: I think you do var thing: ?c.FT_Library = @as(c.FT_Library, undefined); if (thing) |*t| c.ft_functionn(t);
p_____ is now known as dyeplexer
v0idify has quit [Ping timeout: 268 seconds]
v0idify has joined #zig
jokoon has quit [Quit: Leaving]
sord937 has quit [Remote host closed the connection]
sord937 has joined #zig
SebastianM has joined #zig
midgard has quit [Ping timeout: 265 seconds]
v0idify has quit [Ping timeout: 268 seconds]
midgard has joined #zig
wilsonk_ has quit [Read error: Connection reset by peer]
betawaffle has quit [Ping timeout: 240 seconds]
v0idify has joined #zig
kwilczynski has quit [Ping timeout: 240 seconds]
r0bby has quit [Read error: Connection reset by peer]
betawaffle has joined #zig
kwilczynski has joined #zig
r0bby has joined #zig
midgard has quit [Ping timeout: 260 seconds]
SebastianM has left #zig [#zig]
ifreund1 has joined #zig
ifreund has quit [Disconnected by services]
ifreund1 is now known as ifreund
midgard has joined #zig
betawaffle has quit [Read error: Connection reset by peer]
r0bby has quit [Read error: Connection reset by peer]
kwilczynski has quit [Read error: Connection reset by peer]
betawaffle has joined #zig
kwilczynski has joined #zig
r0bby has joined #zig
edr has joined #zig
GrooveStomp has quit [Quit: ZNC 1.7.2+deb3 - https://znc.in]
GrooveStomp has joined #zig
SebastianM has joined #zig
shurane has quit [Ping timeout: 272 seconds]
shurane has joined #zig
shurane has quit [Ping timeout: 246 seconds]
nvmd has joined #zig
shurane has joined #zig
nvmd has quit [Quit: Later nerds.]
shurane has quit [Read error: Connection reset by peer]
nvmd has joined #zig
remby has joined #zig
shurane has joined #zig
SebastianM has quit [Quit: -a- IRC for Android 2.1.59]
<marler8997> wow saw this on reddit, pretty nifty: https://github1s.com/ziglang/zig
<marler8997> lets' you view github repositories in a browser like you're using VSCode
<zags> love it
<zags> need syntax highlighting
<marler8997> yeah I wonder if they could get plugins to work
<zags> should be possible to do the simple ones
kchambers has joined #zig
<marler8997> imagine getting ZLS to work by compiling it to WASM and running it in the browser ??!!??
<zags> cpp highlighting works, but maybe they just hack things using a third party renderer
<DarkUranium> marler8997, there is one for C#, too. I saw it while researching Roslyn.
<DarkUranium> http://sourceroslyn.io/#Microsoft.CodeAnalysis.CSharp/Parser/Lexer.cs,8666332bdcae35ed
<DarkUranium> Well, this one is actually just for Roslyn, but I rather like the idea. I think I might emulate it.
<zags> mmm, nnn really improves the day
<v0idify> ifreund, if i do thing = @as(c.FT_Library, undefined); it still thinks it's null
<v0idify> is std.fs.File thread safe?
timeyyy has joined #zig
<ifreund> v0idify: interesting
<ifreund> I think that should work, unless c.FT_Library is a pointer type
<timeyyy> andrewrk, I was inspired by your article "Announcing the Zig Software Foundation", I am also starting a non profit and would like to copy some of your sentances because they so elegantly say what I want to express. Would this be ok with you?
<v0idify> ifreund, it is a pointer type! why wouldn't that work?
<timeyyy> I plan to use them in an announcment post on the website for the NPO. I can also give you some credit and link to your website
midgard has quit [Quit: midgard disappears from view]
<ifreund> timeyyy: I don't think you need permission to quote andrew's post, only if you pass it off as your own words without acknowledgement
<ifreund> the website currently doesn't have a license though, we should fix that
<ifreund> v0idify: optional pointers are the same size in memory as normal pointers and the 0 value is used to indicate null
<ifreund> optional non-pointer types (and allowzero pointers) use a separate bool to store the null/non-null state
<ifreund> v0idify: If you share the C header you're using I might be able to give better advice
<v0idify> ifreund, it's from FreeType2, the type that it exports is a pointer by itself
<v0idify> oh.. i just didn't have to put a ?
<ifreund> yeah
<v0idify> because it automatically turns into a ?*<inner type>
<ifreund> [*c] may be null already
<ifreund> or if the struct is opaque, then translate-c will output ?*
<ifreund> I really hate C librarys that typdef pointer types...
<v0idify> yeah kinda weird
<v0idify> do we have something like github.com/ai/nanoid?
<ifreund> we have plenty of crypto stuff in the std
<v0idify> yes but i might have to make it myself for this
<ikskuh> if you're the first user of nanoid in zig, i'd love to see the library ported :)
<v0idify> don't make me do crypto stuff :P
<v0idify> how am I supposed to seed a csprng?
<ifreund> I think the std does that for you?
<ifreund> just call e.g. std.crypto.random.int(i32)
<v0idify> oh
<zags> yeah std uses OS entropy
<ikskuh> yeah i think you can trust std.crypto quite well (as long as you trust libsodium)
<v0idify> somehow I made it panic: resumed an async function which already returned
<v0idify> when calling random.bytes
donniewest1 has joined #zig
<ifreund> are you using 0.7.1 or master?
<ifreund> I think std.crypto.random got significantly better since 0.7.1
<v0idify> i'm using some degree of master, no worries i think i figured it out
<v0idify> https://del.dog/festuterap.txt this good?
<v0idify> i'm doing the pos/i thing because it's what nanoid does for compact js.. i'm gonna do this properly
<v0idify> https://del.dog/cruxuqamer.txt less memory usage :)
midgard has joined #zig
jokoon has joined #zig
waleee-cl has joined #zig
timeyyy has quit [Quit: Ping timeout (120 seconds)]
nycex has quit [Remote host closed the connection]
nycex has joined #zig
SebastianM has joined #zig
SebastianM has quit [Quit: -a- IRC for Android 2.1.59]
jokoon2 has joined #zig
eio__ has joined #zig
jokoon has quit [Ping timeout: 246 seconds]
jokoon2 has quit [Ping timeout: 265 seconds]
<v0idify> is fs.File buffered?
<ikskuh> no
<ikskuh> fs.File is direct access to read/write syscalls
<ikskuh> if you want buffering, you can wrap file.reader() or file.writer() in to a std.io.bufferedReader
<v0idify> ok
<dutchie> (or a bufferedWriter)
<v0idify> what happens if I seek?
zags has quit [Ping timeout: 246 seconds]
eio__ has quit [Quit: Leaving]
geemili has joined #zig
donniewest1 has quit [Ping timeout: 256 seconds]
donniewest1 has joined #zig
<v0idify> for some reason this panics https://del.dog/cruxuqamer.txt
<v0idify> when running with evented i/o
zags has joined #zig
<v0idify> i tried with master, still fails
zags has quit [Ping timeout: 246 seconds]
zags has joined #zig
<ifreund> do you get a stack trace?
<dutchie> https://0x0.st/-HyS.txt when i run it
* dutchie also suggests changing the loop to `for (bytes) |*b| b.* = URL_ALPHABET[b.* & 63];`
<dutchie> and fwiw i'd prefer `&a` to get a slice from an array to `a[0..]`
<dutchie> i guess it's a bug in std or async somewhere anyway
a_chou has joined #zig
<ifreund> yeah I'd say that's worth a bug report
hnOsmium0001 has joined #zig
Akuli has joined #zig
<v0idify> dutchie, thanks!
<v0idify> can somebody file the report for me? I don't have a GitHub account and I don't want one
<v0idify> is there a way to force it to run as sync while running the rest of the thing with evented i/o?
dyeplexer has quit [Remote host closed the connection]
jokoon has joined #zig
zags has quit [Ping timeout: 240 seconds]
SebastianM has joined #zig
<SebastianM> Guys, is Zig devel already shipped with musl 1.2.2 ? Thank you:)
<ifreund> SebastianM: no, not yet
<ifreund> I see that a CVE was fixed, I should update it
<SebastianM> ifreund: Thank you
SebastianM has left #zig [#zig]
ky0ko has joined #zig
tane has joined #zig
waleee-cl has quit [Ping timeout: 256 seconds]
waleee-cl has joined #zig
commander has quit [Quit: Lost terminal]
gazler_ has joined #zig
gazler has quit [Ping timeout: 258 seconds]
remby has quit [Quit: Connection closed]
mikdusan has quit [Quit: WeeChat 2.5]
xackus__ has joined #zig
sawzall has quit [Read error: Connection reset by peer]
cole-h has joined #zig
sawzall has joined #zig
jokoon has quit [Quit: Leaving]
gazler__ has joined #zig
gazler_ has quit [Ping timeout: 264 seconds]
xackus__ has quit [Ping timeout: 272 seconds]
ur5us has joined #zig
earnestly has joined #zig
zags has joined #zig
zags has quit [Ping timeout: 256 seconds]
zags has joined #zig
swills has quit [Quit: swills]
<ifreund> man it would be nice to have something for saturating math in std.math
<andrewrk> note that saturating arithmetic is approved as first class operators in the language
<ifreund> oh sweet
zags_ has joined #zig
<ifreund> andrewrk: I'm about to give updating musl to 1.2.2 a go by the way
<andrewrk> sweet! keep your wits about you, and make any updates to that wiki page you deem necessary
<andrewrk> it's always a bit of a manual process
<ifreund> just a patch release so hopefully nothing major will go wrong..
<andrewrk> yeah if there are no changes to musl's build system files or files moved around, I think it should be quite straightforward
zags has quit [Ping timeout: 272 seconds]
xackus__ has joined #zig
zags_ is now known as zags
sord937 has quit [Quit: sord937]
wilsonk_ has joined #zig
voldial has joined #zig
<voldial> any gentoo users around? do you keep your own fork of the portage tree to cherry pick PR's into? https://github.com/gentoo/gentoo/pull/19038
jemius has joined #zig
<jemius> Hola. There is no pure Matrix-room, is there?
<motiejus> #zig:matrix.org , though not as lively as this one
<jemius> isn't that an IRC bridge?
<motiejus> nope, that's a pure matrix room
<motiejus> irc-bridged rooms in freenode are of the form `#freenode_#<channel>:matrix.org`
<motiejus> (bridged by matrix.org, surely)
<jemius> top
<jemius> Since fosdem I'm wondering why I've never heard of Zig before. I've been trolling around in search for a C replacement for a while by now, Rust, Go, D
<ifreund> andrewrk: went smoothly, just a few things in the wiki to update since linking is done by zig code not C++ now :)
<andrewrk> nice
<andrewrk> I'll let the CI do a run through since it tests cross compiling on a few different architectures
<andrewrk> welcome jemius
<andrewrk> provided you can tolerate some instability and immaturity, I think you've come to the right place :)
<jemius> andrewrk, C is a hard nut to crack. We will see about that
<jemius> Zig-Syntax isn't exactly trivial compared to C (not to speak of Go)
<geemili> jemius: What do you mean by that? I was under the impression that zig was much easier to parse since it's more regular than C
jemius has quit [Read error: Connection reset by peer]
jemmi__ has joined #zig
dmgk has quit [Quit: ZNC - https://znc.in]
dmgk has joined #zig
<v0idify> did anyone happen to report the issue i had? :#
<g-w1> you may be able to report it to the mailing list too
<v0idify> this was of course already reported https://github.com/ziglang/zig/issues/7593
<v0idify> it confuses me because i don't see where it is calling anything async in crypto.random or similar
<andrewrk> crypto.random may need to make an OS syscall to /dev/urandom
sebonirc has joined #zig
<jemmi__> https://ziglearn.org/chapter-1/ Shouldn't 7/2 equal 3.5? In example multi-defer
Akuli has quit [Quit: Leaving]
<v0idify> jemmi__, "When there are multiple defers in a single block, they are executed in reverse order."
<g-w1> its reverse order. 2.5 + 2
<zags> andrewrk: doesn't it already do that through getRandomBytesDevURandom ?
<v0idify> zags, it seems it should default to syscalling getrandom though
<v0idify> otherwise it uses that
<zags> ok, crypto should definitely fail if it can't get os entropy
<v0idify> this is def not that
<v0idify> it only fails on evented io, /dev/urandom works
jemmi__ has quit [Quit: Leaving]
<v0idify> why doesn't it say where it was resumed? the stack trace i mean
<daurnimator> v0idify: I'm not sure.... I guess that one of the code paths in tlsCsprngFill is potentially async... need to figure out which one
riba has joined #zig
<v0idify> it still fails with crypto_always_getrandom
<daurnimator> hmmm... if you call `std.os.getrandom` directly yourself do you have the same issue?
<marler8997> getting ready to implement the Win32 COM bindings for Zig :)
<v0idify> daurnimator, nope
<daurnimator> v0idify: sorry I can't see the cause of the problem. don't have enough time to investigate further right now
<daurnimator> I'm getting the bad feeling that it could be a bug with async in general rather than particular to random
<zags> marler8997: so I can soon IDispatch from Zig?
<daurnimator> zags: he's doing it at comptime
<daurnimator> but given that IDispatch is in COM.. you should be able to do it at runtime if you want ;)
<daurnimator> and infact marler8997: comparing your comptime results to what IDispatch tells you at runtime might be useful for test cases
<marler8997> calling IDispatch from Zig, yes
<marler8997> daurnimator, doing it at comptime?
tane has quit [Quit: Leaving]
<daurnimator> marler8997: are you not? I thought this was some of the proceeds of that windows definitions project you were doing
<marler8997> oh I see, yes you're right
<marler8997> calling IDispatch on it's own would be easy
<marler8997> I'm actually going to generate Zig code for all the COM types in win32metadata
ur5us_ has joined #zig
<marler8997> this is the last major thing missing from the bindings at this point
ur5us has quit [Ping timeout: 264 seconds]
Kiori has joined #zig
<zags> marler8997: next, @import("odbc") ? :d
<marler8997> hmmm, I don't see the odbc functions in there, unfortunately
<zags> that's ok, nostalgia isn't what it used to be
<daurnimator> zags: na nostalgia has always been like that ;)
<zags> aye, it's a joke I heard from the BeOS founder
<zags> circular jokes are the best
donniewest1 has quit [Quit: WeeChat 3.0.1]
ur5us has joined #zig
<zags> hm, i can't do generic unions?
ur5us_ has quit [Ping timeout: 272 seconds]
<zags> oh wait, just have a comptime function make the type I guess
sawzall has quit [Read error: Connection reset by peer]
sawzall has joined #zig
ur5us has quit [Ping timeout: 260 seconds]