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/
JoshAshby has quit [Quit: WeeChat 2.9]
ashby has joined #zig
remby has joined #zig
dominikh has joined #zig
nycex has quit [Ping timeout: 240 seconds]
nycex has joined #zig
synaps3 has quit [Ping timeout: 258 seconds]
remby has quit [Quit: Konversation terminated!]
ur5us has joined #zig
<andrewrk> I'm really pleased with where we landed on std lib hash map API
<andrewrk> big thanks to Sahnvour on that one :)
<andrewrk> also there's something really beautiful that emerges with Unmanaged APIs + ensureCapacity + fooAssumeCapacity
earnestly has quit [Ping timeout: 256 seconds]
<karchnu> unmanaged APIs?
<Nilium> I haven't looked at those yet, so that seems like something fun to read through while I'm learning Zig for AOC.
<andrewrk> that's conventionally how I've been naming variants of common data types that omit the allocator: *Allocator field, requiring you to pass the allocator for every method
<andrewrk> idea being if you want N ArrayLists on the heap, and they're all using the same allocator, it's kind of silly to store it in all of them
<karchnu> ok, that's what I didn't understand in the doc
<karchnu> so you can have a structure with tons of lists and hashmaps without any unnecessary memory cost
<karchnu> I saw ensureCapacity while tweaking the tokenizer and the parser, that's nice too
<karchnu> for now I only have good surprises ^^
<andrewrk> ensureCapacity is nice because it removes error handling branches from your code
<andrewrk> feels good to clean up those try's
a92 has joined #zig
<karchnu> coming from C, I was already glad to have hashmaps. :D
<g-w1> I am a little confused, why is "try list.ensureCapacity(list.len + 1); list.appendAssumeCapacity(x);" better than "try list.append(x);"? there is a try in both?
<justin_smith> does std have any regular expressions or do I need to use C for that?
<justin_smith> g-w1: I assumed the context was a known number of appends in a batch
<karchnu> g-w1: in the parser there are many appends following the ensureCapacity
<andrewrk> g-w1, for that example the simple append would be cleaner. the benefit comes in when you have 3 or more appends. then you have fewer `try`
<g-w1> ah, this makes sense, thanks
<andrewrk> or even 2 appends because then there is only 1 point of failure instead of 2
<andrewrk> it can really help with resource management because you can make it impossible for some code to fail in a certain area of code, so that you don't have to worry about rolling something back if OOM occurs
<fengb> But try looks simpler :(
<andrewrk> try is safer, so I think looking simpler is appropriate
<andrewrk> assumeCapacity inserts illegal behavior if your assumption is wrong
factormystic has quit [Read error: Connection reset by peer]
<karchnu> however, it feels a bit redundant with having a large buffer
factormystic has joined #zig
<karchnu> I guess this is not the same thing, since the allocation is dynamic, you can still allocate more
<andrewrk> it all comes down to comptime known vs runtime known
hlolli_ has joined #zig
hlolli has quit [Ping timeout: 272 seconds]
a92 has quit [Quit: My presence will now cease]
decentpe- has joined #zig
decentpenguin has quit [Ping timeout: 272 seconds]
decentpe- is now known as decentpenguin
ur5us has quit [Ping timeout: 260 seconds]
ur5us has joined #zig
<andrewrk> damn, I spent several hours trying to fix #7308 and then realized that my solution was fundamentally missing the problem
frmdstryr has quit [Ping timeout: 256 seconds]
<andrewrk> the bummer thing about #7308 is that I can fix it pretty easily, but it means adding code bloat, runtime logic, and memory usage in order to detect this situation. But it's an uncommon mistake to make and when it happens it is always user error
<g-w1> make it undefined behavior ;)
<andrewrk> I guess it's not so bad, it's just a 16-byte entry in a hash set per C object to be compiled
jjido has quit [Quit: Connection closed for inactivity]
squeek502 has quit [Remote host closed the connection]
<andrewrk> I guess that wasn't so bad: https://github.com/ziglang/zig/pull/7394
notzmv has quit [Remote host closed the connection]
powerofzero has quit [Ping timeout: 260 seconds]
ur5us has quit [Ping timeout: 260 seconds]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
hlolli__ has joined #zig
hlolli_ has quit [Ping timeout: 272 seconds]
lucid_0x80 has joined #zig
<viashimo> is there a way to iterate of the fields of a struct at runtime? I have the list of fields from eg. "var fields = comptime std.meta.fields(StructName)", but if I iterate from 0 to fields.len, I'm not able to access anything. eg fields[i].name will not compile
<viashimo> error: values of type 'std.builtin.StructField' must be comptime known, but index value is runtime known
<viashimo> heh, using fieldNames() works much better
<daurnimator> viashimo: use `inline for`
<daurnimator> though I've been meaning to make a `std.meta.FieldsEnum`...
<viashimo> daurnimator: oh okay, thanks
raggi has quit [Remote host closed the connection]
raggi has joined #zig
_whitelogger has joined #zig
sord937 has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
<rowbee> seems like zls doesn't have argument completion. hmmm
lqd has quit [Quit: Connection closed for inactivity]
SimonNa has quit [Remote host closed the connection]
_whitelogger has joined #zig
xackus has joined #zig
<rowbee> i want to allocate a two-dimensional grid with runtime-determined width and height? i tried doing try allocator.create([height][width]u8); but that obviously fails because the dimensions are not constant
<rowbee> i'd prefer it to be a contiguous chunk of memory
<rowbee> s/i want to/how can i/
<daurnimator> rowbee: I assume something like: `try allocator.alloc(u8, height * width)`
<rowbee> hm... anyway i can convert that to a [][]u8?
<rowbee> i suppose that would be more complicated
<daurnimator> thats a slice of slices: you'd have to store that somewhere
<daurnimator> you could index like: `grid[y*width..(y+1)*width][x]`
<rowbee> i see
<rowbee> no sense in forcing it to be a slice of slices, then
lqd has joined #zig
<rowbee> is there a do-while analogue in zig?
<andrewrk> while (true) { ...; if (!condition) break; }
<rowbee> gotcha ty
<rowbee> are log messages removed in ReleaseFast?
cole-h has quit [Ping timeout: 256 seconds]
<rowbee> ahhh it has different levels based on builtin.mode
<ikskuh> andrewrk: i successfully integrated libsoundio into zig showdown yesterday \o/
<ikskuh> only thing that made me a headache was the latency stuff
<rowbee> is "root" the namespace of my main source file?
<rowbee> hmmm seeing as root.main() is what's called when zig starts up my code i suppose so
<rowbee> yeah there we go
lucid_0x80 has quit [Ping timeout: 256 seconds]
<andrewrk> nice ikskuh!
<ikskuh> yeah!
<ikskuh> it's so satisfying to press the left mouse button and hear a pling :D
wilsonk has quit [Ping timeout: 240 seconds]
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
sord937 has quit [Ping timeout: 240 seconds]
sord937 has joined #zig
kenran has joined #zig
earnestly has joined #zig
wilsonk has joined #zig
sord937 has quit [Ping timeout: 240 seconds]
sord937 has joined #zig
<protheory8-new-m> Is there some kind of struct/function in the standard library for listening to TCP requests?
<dutchie> std.net.StreamServer
<protheory8-new-m> thanks
marijnfs has joined #zig
<rowbee> is there a SIMD copy in std?
semarie has quit [Ping timeout: 256 seconds]
<nore> I tried to pass "-%1" as an argument to a function expecting an usize, and the function got 0 as the argument, is it a bug or is it something I didn't understand correctly?
<ikskuh> i think it's %-, not -%
semarie has joined #zig
<nore> Nah, the doc says -%
<nore> If I pass @as(usize,0)-%@as(usize,1) it works
<nore> But it's quite a bit longer than -%1
<nore> Also, is there a signed size type? (That I could use for indexes that may be negative instead of relying on wrapping arithmetic)
<dch> is it a problem to use a shared zig cache outside the source tree of my git repo?
<dch> I'm thinking of putting it all in /var/cache/zig and mounting it as a tmpfs
<ifreund> probably fine
<ifreund> infact, it might be a bug if that wasn't fine
GreaseMonkey has quit [Ping timeout: 260 seconds]
kenran has quit [Ping timeout: 256 seconds]
kenran has joined #zig
<dch> cool, that didnt work in 20201206 zig master, but it does with today's one.
<marijnfs> how do i grab a variable in a 'closure'
<marijnfs> i want to access an array in a compare function for PriorityQueue
marnix has quit [Ping timeout: 256 seconds]
marnix has joined #zig
<ifreund> you can either use a global or modify PriorityQueue to take a context arg like std.sort does for its compare functions
<ifreund> (if you do the latter please make a PR)
<marijnfs> is there another class that takes some context for reference?
<marijnfs> also, people might not like that change in API, would you have a specific PriorityQueueWithContext struct?
<ifreund> hmm, you could make the signature PriorityQueue(comptime T: type, comptime Context: type) and if Context == void then use the current API
<ifreund> and if Context isn't void then use fn (T, T, Context) bool as the compare function as well as adding a context argument to all the methods
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
<marijnfs> ifreund: I hope that isn't to complicated for the user?
<marijnfs> Are we getting some closures at some point?
<ifreund> nothing that allocates behind your back which is how closures usually work
<ifreund> maybe stack capturing closure-like things: https://github.com/ziglang/zig/issues/6965
<ifreund> maybe that is too complicated, we could also just have them pass {} to every function if they have a void Context
<marijnfs> context is in the end quite simple yeah
<marijnfs> I guess you could pass the reference to context once at init() as well, but maybe that's too inflexible
<ifreund> that's another option yeah
<ifreund> you know, that's probably nicer to use in 99% of cases
<ifreund> and you can always pass a pointer and change what it's pointing to if you need it to be more flexible
<marijnfs> so the signature of init could change depending on what is passed as context type? How do I do that?
<ifreund> currently it's ugly because we don't have #1717 yet.
<ifreund> pub const init = if (C == void) struct { pub fn init(context: C) { ... } }.init else struct { pub fn init() { ... } }.init;
<ifreund> marijnfs: ^
<marijnfs> yeah that 1717 would be sweet
<marijnfs> ifreund: that is some interesting code, forgot you can do if with comptime.. so simple
spiderstew has joined #zig
waleee-cl has joined #zig
<ifreund> yeah comptime is so powerful while remaining very intuitive, it's greatd
LanceThePants has quit [Read error: Connection reset by peer]
sawzall has joined #zig
powerofzero has joined #zig
donniewest has joined #zig
klltkr has joined #zig
<llimllib> I feel really dumb - but how do I remove const to make a string mutable?
<g-w1> iirc, it is inlined in the binary, so it has to be const, but I may be wrong
<dutchie> yeah, you'll
<dutchie> (whhops)
<dutchie> ...most likely have to copy it onto the heap or somewhere else
xackus has quit [Ping timeout: 260 seconds]
<llimllib> well I'm working on that but failing at it too
<fengb> If it’s a literal, you can duplicate it onto the stack like`var foo = bar.*;`
<fengb> “bar”.*
<llimllib> "./a.zig:8:26: error: attempt to dereference non-pointer type '[]const u8'
<llimllib> "
<llimllib> var inputCopy = input.*;
<fengb> Only literals
<fengb> Only comptime known fixed sizes*
<fengb> For variable length, you need an allocation strategy of sorts. allocator.dupe can help
<llimllib> var inputCopy = alloc.dupe(u8, input) catch unreachable;
<llimllib> inputCopy[0] = 'a';
<fengb> If it’s already from an input, can you pass around the non const slice instead?
<llimllib> all I'm trying to get to here is a non const slice
<g-w1> var x = "string".*;
<fengb> You can’t safely remove constness, but you can update the signature so it’s correctly capturing non-constness
<fengb> e.g if you function has (input: []u8), it’s now mutable but you can’t pass literals to it
<llimllib> ok I understand now that the `.*` gives me a const pointer to a string literal
<llimllib> err non-const
<fengb> No, it dereferences the string to make a copy
<llimllib> onto the stack
<fengb> Yeah
<fengb> Literals are always const
<fengb> So if you ever try to de-const it, it should be a segfault
<fengb> Since you’re trying to write to read only memory
<llimllib> roger. so now I have a mutable string but I can't pass it as a []u8? `expected type '[]u8', found '[109:0]u8'`
<fengb> Hmm, what are you trying to do?
<fengb> Is there a bigger code snippet
<fengb> The dupe solution might be okay if you need to actually handle inputs
<llimllib> all I want is to turn an input string into a mutable block of memory
<g-w1> would &maps work to pass? to coerce to a slice?
<fengb> Here’s the problem though
<fengb> Is your input supposed to be from stdin? Or literals?
<fengb> Cause they behave quite differently
<llimllib> I usualy have `main` read from a file
<llimllib> and provide the small examples as string literals
<fengb> Ah
<fengb> Okay, you can pass &maps. It’s an array right after you dereference and copy it to the stack
<fengb> Need to declare it as “var maps” since you’re trying to mutate it
<llimllib> ok that makes sense
<llimllib> closer... now tokenize re-consts is though hah
<llimllib> I guess I can just mem.dupe it onto the stack instead of modifying the original block
<llimllib> alloc.dupe sorry
<llimllib> I really appreciate the help, I am very obviously not used to manual memory management
<fengb> They both have downsides. Duping requires proper memory management
<fengb> Yeah it can be annoying at first
fwg has joined #zig
xackus has joined #zig
g_w1 has joined #zig
g_w1 has quit [Quit: The Lounge - https://thelounge.chat]
marnix has quit [Ping timeout: 240 seconds]
marnix has joined #zig
Akuli has joined #zig
seadragon-droid has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
notzmv has joined #zig
lqd has quit [Quit: Connection closed for inactivity]
lucid_0x80 has joined #zig
cole-h has joined #zig
notzmv has quit [Remote host closed the connection]
notzmv has joined #zig
marnix has quit [Ping timeout: 258 seconds]
marnix has joined #zig
ur5us has joined #zig
SimonNa has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
TheLemonMan has joined #zig
lucid_0x80 has quit [Ping timeout: 258 seconds]
<betawaffle> wait... you can close over comptime vars?
sord937 has quit [Ping timeout: 240 seconds]
<andrewrk> TheLemonMan, I was thinking maybe we bite the bullet and add all the def files from mingw-w64
<andrewrk> maybe after we have a package management system we could figure out how to offload some of those installation size bytes into it
<andrewrk> it would come out to approximately +6 MiB installation size, +656 KB tarball size
cole-h has quit [Ping timeout: 260 seconds]
<TheLemonMan> yeah, teaching the users to do the .def to .lib conversion on their own is much harder heh
<TheLemonMan> have you tried compressing the .def files? we now have a decompressor for .gz files :)
<andrewrk> ah interesting, have the installation keep some sources compressed, that's not a bad idea
<andrewrk> although most def files are small by themselves - the real savings comes when they are compressed with each other in the same tarball
sord937 has joined #zig
<andrewrk> I'm less concerned about the installation size, more concerned about tarball size
<TheLemonMan> then go for it, ~600kB is nothing wrt the whole tarball size
<andrewrk> currently our installation size is 288 MiB, give or take differences in the zig binary for different systems
<andrewrk> alright I'm gonna do it
<betawaffle> wow, that's rather large, but yeah, 600kb isn't much
<TheLemonMan> there's also #6646, that should be pretty easy to add
<betawaffle> ohh, sorry, not the tarball
<andrewrk> betawaffle, 162 MiB of that is the zig binary and ~150 MiB of that is LLVM/Clang/LLD
<betawaffle> wow
<betawaffle> is that with all debug symbols or something?
<fengb> At some point would there be an official zig-lite tarball? :P
radgeRayden has joined #zig
<andrewrk> hmm some of these look pretty sketch though
<andrewrk> why would you ever want to dynamic link msvcp60.dll?
<andrewrk> that .def alone is 525 KB
<TheLemonMan> nostalgia?
fwg has quit [Ping timeout: 260 seconds]
<andrewrk> lol
<betawaffle> what's in that?
<TheLemonMan> runtime for visual C++ 6.0
<TheLemonMan> back to '98
tefter has joined #zig
<leeward> Oh, I remember that. They set the versions of all the things to 6.0.
<andrewrk> hmm I'm going to stick with an explicit list of def files for now. this can remain an unsolved problem while we weigh our options
tom_b has joined #zig
<justin_smith> I'm stumped by a compiler error for an anonymous list of anonymous lists
<justin_smith> I have this declaration: var traversals = .{.{1, 1}, .{3, 1}, .{5, 1}, .{7, 1}, .{1, 2}};
<justin_smith> I get a compiler error on this: for (traversals) |trajectory|, saying that it can't evaluate constant expression
<andrewrk> you can't store that in a var, you'll have to make it const or comptime var
<justin_smith> andrewrk: ahh, I vaguely remember this, thanks
<fengb> Or give it a real type definition
<g-w1> or inline for iirc
<betawaffle> andrewrk: are streams still on fridays?
<andrewrk> I have been on a stream hiatus due to moving, but I'm going to get back into it
hnOsmium0001 has joined #zig
<andrewrk> I want to focus on this 0.7.1 milestone today tho
<TheLemonMan> three tickets left, all of them are windows-related
<andrewrk> all of them are the creator of xmake trying to integrate zig on windows
zippoh has quit [Ping timeout: 240 seconds]
jjsullivan__ has quit [Read error: Connection reset by peer]
jjsullivan has joined #zig
<justin_smith> fengb: yeah, I went with [_][2]usize{[_]usize{1,1} ...}
<justin_smith> that's a lot clearer anyway
<justin_smith> though it seems like the compiler could have inferred the right thing from [_][2]usize{{1,1} ...} - or is there a reason not to infer in a case like that?
<andrewrk> I believe that will work if you fix the syntax
<andrewrk> that is indeed how it is intended to work
<justin_smith> andrewrk: the example in the docs uses both the outer [_][N]type{ ... } and the inner [_]type{ ... } on each item, is there an example of a the correct syntax without the repeated declaration on the inner?
<andrewrk> [_][2]usize{.{1,1} ...}
<andrewrk> I added a `.`
<justin_smith> ahh OK, that did it
<justin_smith> that would be a nice thing to add to the doc section for multidemensional arrays
<andrewrk> agreed
<andrewrk> the .{} syntax is a relatively new feature
<leeward> Thank you, Andrew. One of my gripes about C is that people conflate 1 and true. Python didn't fix this. I just got the following error while porting some C to Zig: "expected type 'bool', found 'u16'" for `if (1 & taccr0.*)`
<leeward> This makes me all warm and fuzzy inside.
<andrewrk> idea here is to make it harder to accidentally write code that runs but doesn't do what you want
<leeward> Yep, it's great.
<leeward> I'm just really glad you got on the "integers aren't booleans" train.
<leeward> I've had arguments with people over the distinction between being an integer and being implemented as an integer.
<ifreund> andrewrk: if you have a minute, I think I've misunderstood the stub .s file thing as I'm getting undefined symbol errors for the things I've put in that file, branch here: https://github.com/ifreund/zig/tree/dyn-musl2
<leeward> Anyway, msp430 update for the day is that I've ported SLAA338A (https://www.ti.com/lit/an/slaa338a/slaa338a.pdf) to Zig and now my blinky blinker is blinking at random.
<leeward> Time to find a 7-segment display and wire it up.
<andrewrk> amazing that you had to implement random numbers
<ifreund> I made a libc_nonshared.a as well which contains the symbols used by the crt1 files since that seemed to be what is done for glibc but that hasn't helped: https://0x0.st/ihRu.txt
<leeward> Well, the project I want to do requires a source of truly random bits.
<andrewrk> ifreund, gimme 10-20 min and then I'll have a look
<leeward> The method is pretty nifty. It uses a slow oscillator and a fast oscillator that are on completely separate hardware but integer multiples of each other, and counts whether there's an odd or even number of fast edges per slow edge.
<ifreund> andrewrk: cool, no rush
<g-w1> leeward: is this bare metal, or is it on an os?
<leeward> g-w1: bare metal; I had to write _start (though to be fair I copied most of it from crt0)
<g-w1> nice
<andrewrk> ifreund, one thing that might help is to have a look around at the differences in the ELF files between the viable libc.so and the not viable libc.so, using the `readelf` tool
<andrewrk> we do expect them to be different because the stubbed one does not need actual implementations of functions, but metadata wise they should be identical I think
<ifreund> that's a good tip, I'll give it a look
<andrewrk> TheLemonMan might get nerd sniped if you play your cards right ;)
<leeward> seems probably
<leeward> probable
<justin_smith> leeward: a name I've heard for the phenomenon that bothers you is "concretization" - replacing some leaky abstraction with its implementation in one's mental model.
<ifreund> yeah so they are definitely not the same, probably cause I barely have any idea what I'm doing with the asm :D
<justin_smith> arguably, much of the negative reaction to clojure from the common lisp community is caused by a concretization around lists, so they are weirdly suspicious of first class data structures that aren't linked lists
<andrewrk> ifreund, if you search your global zig cache dir (probably ~/.cache/zig) for .s files you can find the glibc ones
<andrewrk> uhh musl doesn't need that symver nonsense tho
<ifreund> yeah I found those, though I don't think I should be using symver though
<ifreund> right now readelf -Ws tells me " 1692: 0000000000001210 0 FUNC LOCAL HIDDEN 5 write"
<ifreund> but I want " 1692: 0000000000001210 0 FUNC LOCAL HIDDEN 5 write"
<ifreund> er, copy failed: " 341: 000000000005e2e2 46 FUNC GLOBAL DEFAULT 9 write"
<TheLemonMan> don't use the same .s files we use for glibc
<TheLemonMan> as you can see we mark the "clean" symbol with .hidden and then do the .symver magic
<leeward> justin_smith: That's a good observation.
<ifreund> TheLemonMan: I made a new one by massaging the output of readelf -Ws on libc.so built with musl's Makefile: https://github.com/ifreund/zig/blob/dyn-musl2/lib/libc/musl/c.s
<ifreund> but I've probably done something stupid/obviously wrong as I am not familiar with asm
<TheLemonMan> I do get `1223: 0000000000000000 0 FUNC GLOBAL DEFAULT 1 read`
<ifreund> ... let me clear my cache
<andrewrk> ifreund, zig no longer computes a compiler id based on its own runtime binary
<andrewrk> it's now dependent on the output of `zig version` only
<ifreund> good to know
<ifreund> huh, I still get LOCAL HIDDEN
<ifreund> TheLemonMan: what compile flags did you use? maybe that's where I've screwed up
<TheLemonMan> ifreund, `zig cc /tmp/foo.s -c -o foo1`
<ifreund> thanks, I'll try that
<ifreund> not totally sure what it's doing right now
<andrewrk> ifreund, libc stuff goes into your global cache, not local one
<ifreund> oh, i wiped that as well
<andrewrk> I don't see how that .s file could generate LOCAL HIDDEN symbols
<ifreund> oh I think I know what I've done wrong, I was using the wrong zig
<andrewrk> been there, done that :)
<ifreund> ok no more undefined symbols, but the compiler segfaulted so I'll investigate that and report back if/when I get stuck again
<ifreund> thanks all
<andrewrk> I think we could get rid of libc_nonshared.a for glibc libc.so
<andrewrk> uhh never mind, I got confused for a sec, thought it was inside libc.so but it goes inside your application
<ifreund> it's needed to link into the static crt files afaict
<andrewrk> I think we only need 1 .s file to produce libc.so but there may be static crt files that you are required to link into your app
<TheLemonMan> ifreund, you're better off with `objdump --dynamic-syms`, that's also the command glibc uses for building its own abilist files
<ifreund> good to know thanks
<ifreund> well shit, my dynamically linked musl binary didn't crash
<ifreund> time to try river
notzmv has quit [Remote host closed the connection]
<justin_smith> is there a trick to defining multiple target executables in one build.zig? (or maybe a clever example...) - I have multiple addExecutable calls but I can't figure out how to parameterize the "run" arg via command line
<justin_smith> my current workaround is a Makefile with various targets using the binaries that zig installs
<ifreund> yooo! river runs on musl!
<justin_smith> related: it would be nice if I could tell zig build I only want to build one of the exucutable targets
<ifreund> now I've got a lot of clean up to do before I can make a PR
<TheLemonMan> ifreund, 'grats! :D
notzmv has joined #zig
<ifreund> thanks for the help :)
<andrewrk> nice!
<g-w1> justin_smith, b.addExecutable multiple times doesn't work?
<leeward> TheLemonMan: That's the one.
<leeward> There's a link in that pdf to "software included with this application report." It's a zip file with some code.
<g-w1> justin_smith, you can also make only a certain exe run with `zig build thing` by just copy and pasting the `run` boilerplate when you do `zig init-exe`
<leeward> Looks like I'm gonna have to buy a 7-segment display. I know I had one in a parts bin but can't find it, and can't borrow one from the lab because of the apocalypse.
marnix has quit [Ping timeout: 256 seconds]
marnix has joined #zig
tefter has quit [Ping timeout: 260 seconds]
cren has joined #zig
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
ur5us has quit [Ping timeout: 264 seconds]
powerofzero has quit [Ping timeout: 256 seconds]
<leeward> Well, I found a ticket to a concert from 2004 and a CPLD dev kit, but no 7-segment displays.
<justin_smith> g-w1: addExecutable multiple times does work, but doesn't give me granluarity in terms of what I build, and doesn't let me parametirize zig build run - unless I understand you correctly and I can just define extra build target tasks
<ifreund> justin_smith: you can have e.g. run-foo run-bar and run-zed steps
<ifreund> having it only build one of the executeables could be accomplished through build options
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
<ifreund> stage1 is crashing on me after I refactored a bit :/
<andrewrk> bummer
<ifreund> gdb told me what function it's crashing in though so that's good
<andrewrk> do a little rain dance to make stage1 happy
<ifreund> think I got it, I had written code that shouldn't compile but instead of a compile error I got a crash :D
<fengb> Sounds like C++ 🤔
<ifreund> oh I'm writing zig thanks to #6250
<ifreund> I don't think I would have tried to do this if this code was still in C++
sawzall has quit [Read error: Connection reset by peer]
sawzall has joined #zig
xackus has quit [Ping timeout: 260 seconds]
seadragon-droid has quit [Read error: Connection reset by peer]
tom_b has quit [Quit: Quitte]
SebastianKeller has joined #zig
<ifreund> hmm, should we keep the default of statically linking musl or should it be dynamic by default now?
<ifreund> dynamic is way faster to build with an empty global cache
<andrewrk> ifreund, I think if the target os is native, it should default to dynamic linking musl if the system libc is musl, otherwise default to static linking
<ifreund> that sound reasonable
<ifreund> now to find the code making that decision :D
<andrewrk> the good news is we have all that info already!
<andrewrk> lmk if you want me to point you around
<andrewrk> the decision to static or dynamic link starts at Compilation.zig:575
<andrewrk> there's an is_native_os flag in the Options passed to that function
<ifreund> cool, that saves me some time :)
<andrewrk> finally there is options.target.abi which can tell you musl or glibc
Akuli has quit [Quit: Leaving]
nvmd has joined #zig
nvmd has quit [Client Quit]
cren has quit [Quit: cren]
GrooveStomp has quit [Quit: WeeChat 2.9]
sord937 has quit [Quit: sord937]
jj__ has quit [Quit: Leaving]
jj__ has joined #zig
jj__ has quit [Client Quit]
jjsullivan1 has joined #zig
freshmaker666 has quit [Quit: ZNC 1.8.2 - https://znc.in]
cCCCCcccccCCc has joined #zig
donniewest has quit [Quit: WeeChat 3.0]
<cCCCCcccccCCc> Hi, in the 0.7 series, I've been unable to compile a program I wrote in 0.6 that interfaces with the libz C library. Specifically when I declare a z_stream struct, one of the fields is named 'opaque' and it appears to clash with the language's opaque keyword.
<cCCCCcccccCCc> ./libz.zig:88:9: error: expected token '}', found '.'
<cCCCCcccccCCc> .opaque = null,
<andrewrk> cCCCCcccccCCc, apologies for the incomplete release notes - I hope to get them done soon - but @OpaqueType() has been replaced with `opaque {}` which behaves similar to a struct. You can use @"opaque" syntax for any identifiers that clash with keywords
<cCCCCcccccCCc> andrewrk: Thank you very much, good sir!
<cCCCCcccccCCc> That indeed was the fix.
<andrewrk> happy hacking
kenran has quit [Quit: leaving]
SebastianKeller has quit [Quit: leaving]
<andrewrk> ifreund, https://imgur.com/KCUv8zR.png you have until I finish the 0.7.0 release notes ;)
<andrewrk> j/k I'm happy to help you finish up this project, don't rush it
<ifreund> Oh it's just about done, I just need to get the default thing worked out and write something to autogenerarte the .s file
<ifreund> got distracted by cooking and my flatmate though :)
synaps3 has joined #zig
<andrewrk> hmm how *did* you come up with the .s file before?
marnix has quit [Ping timeout: 240 seconds]
<ifreund_> read the symbols from the libc.so created by musl’s Makefile using readelf and then did some magic with kakoune