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/
jjsullivan1 has quit [Ping timeout: 264 seconds]
<GrooveStomp_> Ahhh! I'm super stoked! I just made a successfully HTTPS request with a Zig program I've been writing.
<demizer> nice!
ur5us_ has joined #zig
xackus_ has quit [Ping timeout: 246 seconds]
<pixelherodev> I would love if stage2 supported plan9
Kena has joined #zig
<pixelherodev> That can come with CBE though, so it's a good thing I'll be working on that again this release cycle :)
<Kena> Does someone know the difference between `write()` and `writeAll()` functions from std.fs.File.Writer type?
<pixelherodev> Kena: did you read the code?
<Kena> *find it in [...]
<Kena> and official documentation does not have a description https://ziglang.org/documentation/0.7.0/std/#std;fs.File.Writer.writeAll
<frmdstryr> writeAll retries until it finishes
<Kena> Thanks.
<pixelherodev> Kena: it's in std/fs/file.zig, not std/fs.zig ;)
<pixelherodev> Note the top of the file:
<pixelherodev> > pub const File = @import("fs/file.zig").File;
Kena has quit [Remote host closed the connection]
squeek502 has joined #zig
squeek502 has quit [Remote host closed the connection]
squeek502 has joined #zig
ur5us_ has quit [Ping timeout: 264 seconds]
earnestly has quit [Ping timeout: 260 seconds]
cole-h has joined #zig
zippoh` has quit [Ping timeout: 260 seconds]
Jeanne-Kamikaze has joined #zig
squeek502 has quit [Remote host closed the connection]
kristoff_it1 has quit [Ping timeout: 240 seconds]
kristoff_it1 has joined #zig
linux-newbie2020 has joined #zig
<linux-newbie2020> How do I create an ArrayList with the general purpose allocator and free it afterwards? Or is using std.testing.allocator the recommended way? Since that one uses gpa on its backend and is easy to use.
<pfg_> linux-newbie2020, std.testing.allocator is for test {} blocks. for main(), do: var gpalloc = std.heap.GeneralPurposeAllocator(.{}){}; defer std.testing.expect(!gpalloc.deinit()); const alloc = &arena.allocator; var array_list = std.ArrayList(u8).init(alloc); defer array_list.deinit();
Yardanico has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
<linux-newbie2020> Thanks!
Yardanico has joined #zig
kristoff_it1 has quit [Ping timeout: 260 seconds]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
Kingsquee has joined #zig
<dominikh> there's no notion of multi-file "packages" in Zig, right? the only way to use identifiers from another file is to @import it?
<marler8997__> usingnamespace is what you want I think
<dominikh> well yeah, but at that point I'm wondering if the API should be designed to read well with or without usingnamespace
<linux-newbie2020> pfg_: additional question, how would I adapt that example for use inside a function that returns the ArrayList? Or would it be cleaner to just hand the allocator to that function?
<pfg_> linux-newbie2020, pub fn returnsArrayList(alloc: *std.mem.Allocator) std.ArrayList(u8) {return std.ArrayList(u8).init(alloc);}
<pfg_> usually you pass the allocator to the function
<pfg_> you can also store the allocator in a global variable if it makes sense for your code, but don't do that if you're making a library
<linux-newbie2020> thanks again!
Jeanne-Kamikaze has quit [Quit: Leaving]
<teratorn> so, im exposing a zig lib to C API. one of the structs that I want to expose has a hashmap member, which can't be exported (?) how can I get around that?
<teratorn> .\amp.zig:50:5: error: extern structs cannot contain fields of type 'std.fifo.LinearFifo(std.hash_map.HashMap([]const u8,[]const u8,std.hash_map.hashString,std.hash_map.eqlString,80),std.fifo.LinearFifoBufferType { .Dynamic = {}})'
<teratorn> box_buffer: AmpBoxFifo,
<teratorn> ^
<teratorn> .\amp.zig:307:23: note: referenced here
<teratorn> var dec = AmpCodec.init(alloc);
<teratorn> well its a LinearFifo actually
<teratorn> I want to export the struct opaquely to C
<teratorn> but I don't know how except by casting to c_void or whatever
<teratorn> do i create an empty struct and use that as a casting target to achieve opaque pointers with a unique name?
mmohammadi9812 has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
kacak has joined #zig
aerona has quit [Quit: Leaving]
a_chou has joined #zig
a_chou has quit [Remote host closed the connection]
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
cole-h has quit [Ping timeout: 260 seconds]
<teratorn> how do you alloc a struct on the heap?
<teratorn> so i use alloc()? how do i init the struct with {} syntax?
<teratorn> i guess that is a _type_ so can I just use that syntax verbatim?
<teratorn> what does an error like this mean? parameter of type '*AmpBox' has 0 bits; not allowed in function with calling convention 'C'
<novaskell> it's a namespace thus cannot be represented in C as it has no memory representation
<teratorn> but AmpBox is a struct!
<novaskell> can I see the code?
<teratorn> how can any pointer have no bits?
<teratorn> sure one sec
<novaskell> `const AmpBox = struct` doesn't contain any fields which makes it take 0 bits
mmohammadi9812 has quit [Ping timeout: 260 seconds]
<novaskell> using `pub var thing = stuff;` just declares `thing` as a global variable and not as a field member of the struct `AmpBox`
mmohammadi9812 has joined #zig
<teratorn> uhm but it has a variable member inside
<teratorn> oh
<teratorn> .\amp.zig:29:13: error: expected token '}', found ';'
<teratorn> a: usize;
<teratorn> ^
<pfg_> teratorn, `,`
<teratorn> i cant seem to declare a struct with one usize member
<teratorn> oh right
pfg_ has quit [Quit: Leaving]
pfg_ has joined #zig
<pfg_> It should probably be possible to improve the error message for that
GrooveStomp_ has quit [Ping timeout: 265 seconds]
sord937 has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
linux-newbie2020 has quit [Quit: leaving]
ur5us_ has joined #zig
skuzzymiglet has joined #zig
skuzzymiglet has quit [Ping timeout: 260 seconds]
ur5us_ has quit [Ping timeout: 264 seconds]
xackus_ has joined #zig
earnestly has joined #zig
TheLemonMan has joined #zig
marnix has quit [Ping timeout: 256 seconds]
marnix has joined #zig
<alexnask[m]> ifreund: Hey, I was just wondering if semantic token highlighting with the custom token modifiers (e.g. type.struct) works ok for you in kak-lsp
<alexnask[m]> Kate in the discord apparently can't get it to work even after adding the token modifiers to the toml file
marnix has quit [Ping timeout: 260 seconds]
<TheLemonMan> Is kakoune's fork for edgelords called kek?
<ikskuh> kek
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
xackus_ has quit [Remote host closed the connection]
xackus has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
xackus has quit [Ping timeout: 272 seconds]
<dominikh> hm, so std.ChildProcess has neither a fd I can poll for process termination, nor a way to specify which fds I want to be passed to the new process, right?
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
xackus has joined #zig
Kingsquee has quit []
<TheLemonMan> dominikh, the latter is an interesting feature request, the former should be easily handled by calling wait()
<TheLemonMan> you can always cheat and assume the child process is dead when the std handles are closed
kristoff_it1 has joined #zig
<dominikh> TheLemonMan: I mean, I can't just call wait if I want to continue doing other things on that thread. the options then are a sigchild handler (which isn't that great), or a pipe (or maybe signalfd) and polling for it to get closed when the child exits.
<dominikh> or I could go all in on pidfd and annoy non-Linux users…
trickyfungus has joined #zig
<trickyfungus> hi!
trickyfungus has quit [Read error: Connection reset by peer]
trickyfungus1 has joined #zig
trickyfungus1 is now known as trickyfungus
trickyfungus has quit [Read error: Connection reset by peer]
braket3 has joined #zig
osa1_ has joined #zig
rolaids_guy has joined #zig
techtirade_ has joined #zig
osa1 has quit [*.net *.split]
techtirade has quit [*.net *.split]
st4ll1 has quit [*.net *.split]
nore has quit [*.net *.split]
edr has quit [*.net *.split]
jicksaw has quit [*.net *.split]
braket has quit [*.net *.split]
freshmaker666 has quit [*.net *.split]
albertito has quit [*.net *.split]
lucus16 has quit [*.net *.split]
johnLate has quit [*.net *.split]
johnLate has joined #zig
albertito has joined #zig
edr has joined #zig
edr has quit [Changing host]
edr has joined #zig
jicksaw has joined #zig
st4ll1 has joined #zig
lucus16 has joined #zig
nore has joined #zig
freshmaker666 has joined #zig
freshmaker666 has joined #zig
freshmaker666 has quit [Changing host]
josias has quit [*.net *.split]
ifreund_ has quit [*.net *.split]
ovf has quit [*.net *.split]
kwilczynski has quit [*.net *.split]
r0bby has quit [*.net *.split]
dongcarl has quit [*.net *.split]
Snetry has quit [*.net *.split]
mixi has quit [*.net *.split]
rzezeski has quit [*.net *.split]
rolaids_guy has quit [Ping timeout: 256 seconds]
amk has quit [Ping timeout: 264 seconds]
r0bby has joined #zig
Snetry has joined #zig
rzezeski has joined #zig
ifreund_ has joined #zig
kwilczynski has joined #zig
dongcarl has joined #zig
mixi has joined #zig
ovf has joined #zig
josias has joined #zig
amk has joined #zig
dongcarl has quit [Max SendQ exceeded]
dongcarl has joined #zig
kwilczynski has quit [Ping timeout: 246 seconds]
lroy64[m] has quit [Ping timeout: 246 seconds]
novaskell has quit [Ping timeout: 246 seconds]
r0bby has quit [Ping timeout: 246 seconds]
Snektron has quit [Ping timeout: 240 seconds]
gpanders[m] has quit [Ping timeout: 240 seconds]
bfredl has quit [Ping timeout: 244 seconds]
BaroqueLarouche has quit [Ping timeout: 244 seconds]
Sergeeeek[m] has quit [Ping timeout: 244 seconds]
fengb has quit [Ping timeout: 244 seconds]
ugla has quit [Ping timeout: 244 seconds]
alexnask[m] has quit [Ping timeout: 260 seconds]
aterius has quit [Ping timeout: 268 seconds]
znowflak3[m] has quit [Ping timeout: 268 seconds]
Dominic[m] has quit [Ping timeout: 268 seconds]
r0bby has joined #zig
kwilczynski has joined #zig
ifreund_ has quit [Ping timeout: 246 seconds]
sergeeeek[m]1 has quit [Ping timeout: 246 seconds]
Nypsie[m] has quit [Ping timeout: 246 seconds]
josias has quit [Ping timeout: 246 seconds]
srgpqt[m] has quit [Ping timeout: 240 seconds]
protheory8-new-m has quit [Ping timeout: 240 seconds]
amk has quit [Changing host]
amk has joined #zig
bfredl has joined #zig
Snektron has joined #zig
alexnask[m] has joined #zig
novaskell has joined #zig
lroy64[m] has joined #zig
<alexnask[m]> hihi
znowflak3[m] has joined #zig
gpanders[m] has joined #zig
BaroqueLarouche has joined #zig
fengb has joined #zig
Sergeeeek[m] has joined #zig
ugla has joined #zig
sergeeeek[m]1 has joined #zig
Nypsie[m] has joined #zig
<ikskuh> alexnask[m]: looks like we were on the right side of the split :)
josias has joined #zig
srgpqt[m] has joined #zig
protheory8-new-m has joined #zig
<alexnask[m]> best side
lltt has quit [Ping timeout: 256 seconds]
osa1_ is now known as osa1
nycex has joined #zig
aterius has joined #zig
Dominic[m] has joined #zig
ifreund_ has joined #zig
waleee-cl has joined #zig
kristoff_it has joined #zig
kristoff_it1 has quit [Ping timeout: 260 seconds]
xackus has quit [Ping timeout: 246 seconds]
xackus has joined #zig
viaken has joined #zig
cole-h has joined #zig
<TheLemonMan> pro tip, remember to unmount every bind-mounted device from your chroots before rm -rf'ing them
<TheLemonMan> rebooting, wish me luck
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
gazler_ has quit [Ping timeout: 256 seconds]
a_chou has joined #zig
gazler has joined #zig
aerona has joined #zig
reductum has joined #zig
marnix has quit [Read error: Connection reset by peer]
a_chou has quit [Remote host closed the connection]
marnix has joined #zig
gert_ has joined #zig
g-w1 has quit [Ping timeout: 256 seconds]
braket3 has left #zig ["The Lounge - https://thelounge.chat"]
g-w1 has joined #zig
<scientes> --one-file-system
braket has joined #zig
gert_ has quit [Quit: WeeChat 2.9]
gert_ has joined #zig
<demizer> hey guys, I am using `pub const log_level: std.log.Level = .debug;` in a logger.md file and importing that into my other source files to access wrappers to std.log. But the log_level is not taking affect. Not sure what "root.log_level" is in the log source, but I suspect I might be using it wrong. Any help would be greatly appreciated!
sord937 has quit [Ping timeout: 240 seconds]
sord937 has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
xackus has quit [Ping timeout: 256 seconds]
<demizer> found the problem, i needed to set the testing log level: `std.testing.log_level = std.log.Level.debug;`
mmohammadi9812 has quit [Read error: Connection reset by peer]
mmohammadi9812 has joined #zig
mmohammadi9812 has quit [Ping timeout: 256 seconds]
mmohammadi9812 has joined #zig
Jeanne-Kamikaze has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
<kristoff_it> We're live with the Zig SHOWTIME preshow, we start in ~15mins https://twitch.tv/kristoff_it
Jeanne-Kamikaze has quit [Ping timeout: 256 seconds]
<demizer> does anyone know how to replace the root.log when running tests in a library with "zig test test.zig". I am utterly confused. I can reset std.testing.log_level but not std.testing.log. It has something to do with the root source file but test.zig doesn't seem to be that for zig test in my case.
remal has joined #zig
hnOsmium0001 has joined #zig
kacak has quit [Ping timeout: 246 seconds]
<demizer> i think i found the root logger i am trying to override, https://github.com/ziglang/zig/blob/master/src/main.zig#L71, anyone know how i could do that?
remal has quit [Ping timeout: 256 seconds]
data-man has joined #zig
<data-man> demizer: 'root' isn't available during testing. See https://github.com/ziglang/zig/issues/6621
data-man has quit [Client Quit]
<demizer> data-man: thanks!
frmdstryr has quit [Remote host closed the connection]
frmdstryr has joined #zig
remal has joined #zig
ur5us_ has joined #zig
lltt has joined #zig
wootehfoot has joined #zig
sord937 has quit [Ping timeout: 240 seconds]
radgeRayden has quit [Ping timeout: 272 seconds]
remal has quit [Quit: Reconnecting]
remal has joined #zig
<ugla> What's the easiest way to readFloat(bits)?
Jeanne-Kamikaze has joined #zig
<g-w1> I have a question about how the stage2 ir works. Does a Decl have to be something like error {Thing1, Thing2} or struct {x: u32}, or can it be something like (error {P} || InnerError)? Does the user have to create the decl, or can it be created as the product of other things? (in my case can merging error sets create another Decl?)
Enrico204 has joined #zig
<pfg_> q-w1 I believe `error {P} || InnerError` would be represented as `@1 = error {P}; @2 = InnerError; @3 = @1 || @2`
<pfg_> I'm not sure how decls work right now though so I might be wrong or that might not be useful
marnix has quit [Read error: Connection reset by peer]
riba has joined #zig
marnix has joined #zig
<pixelherodev> g-w1: a decl is anything which can be used as a rhs value, as I understand it
<g-w1> ah, so it would be a decl, just anon?
<pixelherodev> e.g. `const a = (error{P}||InnerError}` would have a decl for the value of a, I think?
<g-w1> ok. cool
<pixelherodev> When in doubt, follow a path through the code
<pixelherodev> Not necessarily with a debugger, though that can help, but just reason it out
<pixelherodev> Look at astgen's existing patterns, for instance
<ikskuh> heya pixelherodev o/
<pixelherodev> ikskuh: Hi!
<pixelherodev> Finally going to get more CBE work done tonight! :D
<ikskuh> whoo! \o/
<ikskuh> I'm hacking a SD card driver
<pixelherodev> spu?
<g-w1> im trying to just copy the way to create a regular error set, and then make another, but its not woring :(. the cbe seems very nice. i cant wait to play telephone with translate-c and the cbe :]
marnix has quit [Ping timeout: 256 seconds]
marceco has joined #zig
<gert_> loving zig very cool
<ikskuh> heya gert_
<ikskuh> you new here? :)
<gert_> I lurk
<ikskuh> ah!
riba has quit [Ping timeout: 256 seconds]
a92 has joined #zig
marceco has quit [Ping timeout: 245 seconds]
<freshmaker666> just learned about zig. I don't understand this section: https://ziglang.org/documentation/master/#toc-Anonymous-List-Literals . Aren't the literals typed as u8? Why is that considered an omission?
<ikskuh> heya freshmaker666
<freshmaker666> hello there
wootehfoot has quit [Read error: Connection reset by peer]
<ikskuh> i'll answer in a second :D
<freshmaker666> np no rush, just enjoying my night
<ikskuh> european? :D
<freshmaker666> well, a european bouncer ;)
Jeanne-Kamikaze has quit [Quit: Leaving]
xackus has joined #zig
<ikskuh> heh
<ikskuh> those list literals are … magic
<ikskuh> they can coerce to anything that fits
frmdstryr has quit [Ping timeout: 260 seconds]
<ikskuh> so you can do
<ikskuh> var array: [3]u8 = .{ 1, 2, 3 };
<ikskuh> var array: [2]f32 = .{ 1, 2 };
<freshmaker666> ah!
<ikskuh> note that you can *also* store them
<ikskuh> without coercion
<ikskuh> var magic = .{ 1, 2 };
<ikskuh> this is special
<ikskuh> how firm are you with the language already?
<freshmaker666> oh not firm at all. I heard about it and then just popped open the documentation to see what was up. I think I found out about it through an ouroborus quine program or maybe it was someone doing a cipher spec in zig.
<ikskuh> ah
<ikskuh> quine:
<ikskuh> pub fn main() { std.debug.print("{}", .{ @embedFile(@src().file) }); }
<ikskuh> :D
<freshmaker666> nice! ha ha
<a92> That's kinda cheating
<ikskuh> why? :D
<ikskuh> freshmaker666: i would recommend you playing around with zig :)
<ikskuh> it's a really fine language and you can learn it quite fast
<ikskuh> do you have programming experience already?
<freshmaker666> yeah, just popular ones. for actually useful work things mostly Go. But I'll poke at C if something is missing in a utility I'm using.
<a92> Quines aren't supposed to just read the source file; there are ways to do it without that and such methods are more interesting
<ikskuh> yeah i know
<ikskuh> a92: but! i'm not reading the source file at runtime :D
<ikskuh> that quine is standalone *grin*
<ikskuh> freshmaker666: i think zig can be your language than
<freshmaker666> no reason why not. just fun to learn new things anyway.
reductum has quit [Quit: WeeChat 2.9]
<a92> But then it doesn't work, ikskuh
<ikskuh> why?
<a92> ... oh, it would
<ikskuh> @embedFile is compile time :D
<ikskuh> so imho it's technically a correct quine :D
<ikskuh> kristoff_it: you wanted snippets. use that quine above! :D
<ikskuh> pub fn main() void { @import("std").debug.print("{}", .{ @embedFile(@src().file) }); }
<ikskuh> here's a working version
<g-w1> is lldb a work in progress? whenever i use it it just crashes.
<ikskuh> huh?
<ikskuh> hm
<ikskuh> i think so
<ikskuh> i always use gdb
<g-w1> i was using gdb, but its hard to edit the commands on the gdb line input, and so i thought i would try lldb, but it just oofed. maybe zig triggers it https://share.olind.xyz/f.php?h=1OIy-F6T&p=1
<g-w1> lldb seems to be a lot more modern, but less reliable. do you know of any good standalone frontends for gdb?
reductum has joined #zig