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/
metaleap has quit [Quit: Leaving]
ur5us has joined #zig
seoushi has quit [Ping timeout: 265 seconds]
dimenus has quit [Ping timeout: 268 seconds]
seoushi has joined #zig
<fengb> How much memory can the compiler use?
<Snektron> All probably
<daurnimator> fengb: our rule is that the compiler can't use more than 4GB when compiling the test suite
<fengb> So my silly 500 KB compile lookup is nothing :P
<Snektron> daurnimator, but is there an explicit memory usage bound in general
<fengb> Oh yeah that's due to Azure falling over at ~4.5GB
waleee-cl has quit [Quit: Connection closed for inactivity]
lunamn has quit [Ping timeout: 260 seconds]
qazo has joined #zig
<daurnimator> fengb: also the desire to run on a 32bit machine
lunamn has joined #zig
<seoushi> ./src/ecs.zig:144:17: error: expected 2 arguments, found 1
<seoushi> warn("hi\n");
<seoushi> not sure what I'm doing wrong here
<seoushi> warn is consted as std.debug.warn at the top
<BaroqueLarouche> warn("hi\n", .{});
<BaroqueLarouche> there is no longer var args in the language
<seoushi> oh ok
<seoushi> I was confused because i had that earlier and it worked and it was in some other code as well but I guess that code doesn't have a path to it so it isn't compiled
ky0ko_ has joined #zig
<fengb> `isFinite(std.math.nan(f32)) => false`
<fengb> Can I rely on this?
azth has joined #zig
azth has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 265 seconds]
metaleap has joined #zig
<seoushi> does zig have closures? looking to do something like this: fn(something : usize) fn(usize) usize { return fn (num : usize) usize { return num + something; }; }
<fengb> There's a way to fake closures with comptime args
<metaleap> fengb: how to? so far i did the old "keep context struct to pass to fn ptr that requires such a ctx arg"
<fengb> Yeah that's probably the "correct" way atm but that's not really closures :P
<seoushi> thanks. that isn't quite gonna work for me I think. What I want to do is have an ArrayList(MultipleTypes). So my idea was to create a wrapper for Multiple types so I can use a *void to the data and then "generic functions" to do something to that data
<metaleap> yeah just manual keeping of "an environment"
<fengb> I'm not sure we can make them work well since any non-trivial closure has implicit allocations
<fengb> Are the types known at compile time? You can use a union and switch on the tag
<seoushi> It's easy enough to create the items via comptime and throw them into the array list but then I no longer know the type so I can't really cast it back to edit the data
<metaleap> fengb "There's a way to fake closures with comptime args" gimme the 5-second coarse description of what you have in mind, i'll try to piece the puzzle together from there , muchos thxos
<seoushi> hmm. they are known at compile type but the interface I have doesn't quite work that way. I set it up so you register a type for each item. I could potentially make it a union but I expect in some case there will be a hundred different types
<metaleap> seoushi: either tagged-union or with wrapper struct `Wrap(T)` that exposes a non-field member-decl `pub const TheType: type = T` for latter comptime extraction via `@TypeOf(my_wrap).TheType`
<metaleap> (if thats possible to carry along in your design, not always applicable)
<seoushi> Yeah if I can save the type off and use it again to reconstruct the type then that would work for me
<seoushi> let me mock something up...
<fengb> It's not pretty... https://godbolt.org/z/Q8STBk
<fengb> And it only works with comptime args
<metaleap> fengb merci
<metaleap> ahh neat heh
<fengb> comptime is the only time when we can "make" allocations happen like this
<fengb> Otherwise there needs to be a pointer to the data somewhere
<fengb> Also the "create struct / create method / return function" pattern exists as a workaround because we don't have anon functions yet: https://github.com/ziglang/zig/issues/1717
<metaleap> so thats like instantiating/cloning the struct+func per unique comptime arg value, rarely needed but yeah a possibility when it is =)
<seoushi> something like this
<metaleap> no i said "non-field member decl" in the wrapper struct
<fengb> Daurnimator had a less contrived example but I don't remember it heh
<metaleap> but otherwise yeah
<metaleap> a `type`-typed field might even work and be turned into a non-field struct member decl but wouldnt expect it at least
ltriant has quit [Quit: leaving]
<fengb> doSomething doesn't have access into the struct. It needs a reference, like self variable
tbodt has quit [Ping timeout: 246 seconds]
<metaleap> also if all you later get at runtime is that arraylist of usize "pointers", you really need to have a sound reason why your generic/comptime func decides to ptrcast it to *this* or *that* underlying T
<metaleap> somewhere somehow some association tag must always be carried along for usize-to-ptr-of-X
<metaleap> seoushi: here's how I'm currently doing it, see call sites at L68 or L77 using a custom/fully-userland "env-capture" struct type called here Ctx:
<metaleap> then the fn-ptr gets put into the equivalent of ArrayList(usize), actually a struct with that fn_ptr and pointer-to-copy-of-ctx and some extra info, here: https://github.com/meta-leap/jsonic/blob/master/src/jsonrpc_engine.zig#L230
<seoushi> thanks I'll take a look at that
<fengb> You can also do the old school way of sharing a blob of memory via union casting
<metaleap> so ptr-of-byte-array to ptr-of-TUnion?
<metaleap> (or vice versa)
<fengb> Yeah, make sure first chunk has the type id embedded
<seoushi> so before reading that other stuff. I tried doing this https://gist.github.com/seoushi/60e846452637b131221adf1dad0284d7 and got an error. I didn't quite understand the non-field member-decl thing
<fengb> So union { A, B, C } all overlap with the identifying data
<fengb> comptime var data = Wrapper{} is trying to define a comptime struct
<metaleap> fengb old school is best school
<fengb> But `var intValue = try allocator.create(u32);` is a runtime only construct
<seoushi> yeah. without that comptime there I get a differnt error tho
<seoushi> error: cannot store runtime value in type 'type'
<metaleap> seoushi your struct type can have fields, these "belong to any this-struct's instance" so to speak. but it can also have other members: fns or consts. these belong to the struct type
<fengb> Oh, types are comptime only by definition
<fengb> You need some other data structure to store the type. We usually use enums for that
<fengb> https://github.com/fengb/korwerdna/blob/master/src/op.zig#L5 I have a million different type references like this -_-
<daurnimator> fengb: I had an example of what now?
<fengb> Faking closures with comptime args
<fengb> I'm pretty sure you showed something that wasn't silly looking
<daurnimator> I'm not sure what you're referring to...
<fengb> I'm going crazy then!
<seoushi> So to give a better picture of what I'm trying to do. I'm working on creating an entity component system. User will register components. So this question came into play because I wanted an array of Pool(multi types). enum do work but I would like to be able to define sets of components you can use seperately. Say a set of components that are for 2d rendering and another for 2d physics etc and I don't really want to have all
<seoushi> of those at once because depending on the possible components it will allocate a pool per component type
rappet has quit [Ping timeout: 246 seconds]
<seoushi> I think my best way at this point is that I need to just make a pool type based on raw bytes instead of an ArrayList(componentType) then I won't need to do the casting. That is what I did in my C version atleast
rappet has joined #zig
metaleap has quit [Quit: Leaving]
_whitelogger has joined #zig
dddddd has quit [Remote host closed the connection]
_Vi has joined #zig
ur5us has joined #zig
_Vi has quit [Ping timeout: 246 seconds]
return0e_ has joined #zig
nofmal has joined #zig
ur5us has quit [Ping timeout: 265 seconds]
knebulae has quit [Quit: Leaving]
nofmal has quit [Remote host closed the connection]
ky0ko_ has quit [*.net *.split]
dingenskirchen has quit [*.net *.split]
jmiven has quit [*.net *.split]
karrick has quit [*.net *.split]
eddyb[legacy] has quit [*.net *.split]
SyrupThinker has quit [*.net *.split]
dom96 has quit [*.net *.split]
terinjokes has quit [*.net *.split]
AlexMax has quit [*.net *.split]
BitPuffin has quit [*.net *.split]
fengb has quit [*.net *.split]
mixi has quit [*.net *.split]
tines9 has quit [*.net *.split]
rappet has quit [*.net *.split]
lukeholder has quit [*.net *.split]
torque has quit [*.net *.split]
occivink has quit [*.net *.split]
m6w6 has quit [*.net *.split]
rom1504 has quit [*.net *.split]
mgxm has quit [*.net *.split]
gruebite has quit [*.net *.split]
Yardanico has quit [*.net *.split]
strmpnk has quit [*.net *.split]
blueberrypie has quit [*.net *.split]
novaskell has quit [*.net *.split]
cncl has quit [*.net *.split]
dch has quit [*.net *.split]
jicksaw has quit [Ping timeout: 240 seconds]
dom96 has joined #zig
nyberg has quit [*.net *.split]
D3zmodos has quit [*.net *.split]
chris| has quit [*.net *.split]
tines9 has joined #zig
AlexMax has joined #zig
mixi has joined #zig
BitPuffin has joined #zig
fengb has joined #zig
benjif_ has quit [*.net *.split]
nrdmn has quit [*.net *.split]
mikdusan has quit [*.net *.split]
bheads has quit [*.net *.split]
jonathon has quit [*.net *.split]
Sahnvour_ has quit [*.net *.split]
wilsonk has quit [*.net *.split]
blackbeard420 has quit [*.net *.split]
gonz_ has quit [*.net *.split]
yth has quit [*.net *.split]
meowray has quit [*.net *.split]
cmrs has quit [*.net *.split]
mmx870 has quit [*.net *.split]
letoram has quit [*.net *.split]
via has quit [*.net *.split]
edr has quit [*.net *.split]
bbrittain has quit [*.net *.split]
benaiah has quit [*.net *.split]
dingenskirchen has joined #zig
jmiven has joined #zig
ky0ko_ has joined #zig
SyrupThinker has joined #zig
karrick has joined #zig
terinjokes has joined #zig
occivink has joined #zig
strmpnk has joined #zig
blueberrypie has joined #zig
cncl has joined #zig
dch has joined #zig
novaskell has joined #zig
rappet has joined #zig
Yardanico has joined #zig
lukeholder has joined #zig
rom1504 has joined #zig
m6w6 has joined #zig
gruebite has joined #zig
torque has joined #zig
mgxm has joined #zig
jonathon_ has joined #zig
edr has joined #zig
\u has joined #zig
cbarrett has quit [Ping timeout: 246 seconds]
cmrs has joined #zig
blackbeard420 has joined #zig
benaiah has joined #zig
cbarrett has joined #zig
bbrittain has joined #zig
via has joined #zig
letoram has joined #zig
jicksaw has joined #zig
benjif_ has joined #zig
benjif_ is now known as benjif
_Vi has joined #zig
seoushi has joined #zig
waleee-cl has joined #zig
seoushi has quit [Ping timeout: 265 seconds]
Joefish has joined #zig
benjif has quit [Remote host closed the connection]
dimenus has joined #zig
decentpenguin has joined #zig
Joefish_ has joined #zig
Joefish has quit [Ping timeout: 265 seconds]
benjif has joined #zig
marmotini_ has joined #zig
marmotini_ has quit [Remote host closed the connection]
marmotini_ has joined #zig
marmotini_ has quit [Remote host closed the connection]
Joefish_ has quit [Quit: Leaving]
benjif_ has joined #zig
benjif has quit [Ping timeout: 240 seconds]
dddddd has joined #zig
benjif has joined #zig
benjif_ has quit [Read error: Connection reset by peer]
eagle2com has joined #zig
knebulae has joined #zig
<betawaffle> how do i decide between `@import("builtin")` and `std.builtin`?
<mq32> betawaffle: always use std.builtin, as it contains a usingnamespace on @import("builtin")
<mq32> also the std-file defines all the types
ofelas has quit [Ping timeout: 268 seconds]
eagle2com has quit [Remote host closed the connection]
<mq32> oh
<mq32> they are both cyclic usingnamespace now
<mq32> crazy that this is even possible :D
<fengb> Not really. Zig is pretty lazy and namespaces can reference each other without problems
<betawaffle> what's the point of having both ways of doing it?
<betawaffle> is one going to go away at some point?
<fengb> Unless you do stupid things like me: https://github.com/ziglang/zig/issues/4274
<fengb> I'm not sure which direction we're going
<companion_cube> when's the next stream, btw?
Joefish has joined #zig
eagle2com has joined #zig
<pixelherodev> Did Zig end up applying as an org for GSoC?
<SyrupThinker> Interested in that aswell
decentpenguin has quit [Quit: decentpenguin]
<pixelherodev> There's a ziglang mailing list? How did I miss that? :)
<SyrupThinker> Me neither, a friend just told me because I read out loud
<SyrupThinker> Grammar, meant I missed it aswell
<pixelherodev> I'm guessing a self-hosted LLVM backend is just *slightly* out of scope? :P
Joefish_ has joined #zig
Joefish has quit [Ping timeout: 265 seconds]
Joefish_ has quit [Quit: Leaving]
eagle2com has quit [Ping timeout: 248 seconds]
<mq32> oof
<mq32> gen_h isn't much tested, right?
<mq32> `text_screen: [18][24]u8` gets translated to `uint8_t text_screen[18]`
seoushi has joined #zig
return0e_ has quit [Remote host closed the connection]
cmrs has quit [Quit: ZNC 1.7.1 - https://znc.in]
cmrs has joined #zig
dimenus has quit [Read error: Connection reset by peer]
dimenus has joined #zig
metaleap has joined #zig
<seoushi> found a compiler bug when trying out another possible solution to store type information. https://gist.github.com/seoushi/03ca5a09e1dfa7511c1c6a719491b092
<seoushi> I'm guess that is just doesn't like the type in the arraylist
\u is now known as meowray
<seoushi> Guess I'll just fall back to an enum after all. Not quite what I wanted but it's easier to reason about.
<fengb> I think the entity system would work well with traits/interfaces
<companion_cube> still no docs on interfaces? :D
<seoushi> Yeah I'm kinda going down that path. Basically I define a few functions that are required in a struct since I use @field to access them.
<fengb> Allocator is the standard pattern style
dimenus has quit [Read error: Connection reset by peer]
<seoushi> I haven't looked at that code yet. I'll take a look and see how it's done
dimenus has joined #zig
<fengb> There’s also this long standing issue: https://github.com/ziglang/zig/issues/130
<seoushi> ah ok. so interfaces are just assignable function fields. I was going that way at first and might go back to it if this experiment doesn't work.
<companion_cube> c o m p t i m e v t a b l e
Akuli has joined #zig
mmx870 has joined #zig
jjido has joined #zig
<pixelherodev> `%s/substr_match(\"\(.*\)\")/\=join(["substr_match(.{\"",submatch(1),"\"})"], "")/g` that's got to be the single longest vim command I've ever used :P
<pixelherodev> Refactored a function so that it takes a tuple of N strings instead of a single string and checks if *any* of them match, and I ended up taking more time reading the Vim manual and figuring out how to construct that command than it would've taken to edit them all manually
<companion_cube> that's when you want to use /gc
<pixelherodev> nah, I'm confident enough that this would only match the intended scenarios
<fengb> Hallmark of a dev: replace a boring task with a much more interesting one that takes longer
<pixelherodev> ... okay so uh, what does `/home/noam/Documents/Development/osjw/ziggirat/src/parsers/llvm-9.zig:255:39: error: use of undefined value here causes undefined behavior
<pixelherodev> ` mean?
<pixelherodev> Whoops
<pixelherodev> Just meant to paste the error message. Meh, whateves
<companion_cube> https://xkcd.com/1205/
<pixelherodev> Yeah but now I know how to do it in the future
<pixelherodev> So it adds up
<companion_cube> actually: https://www.xkcd.com/974/
<pixelherodev> Hmm. `substr_match(.{magic_identifier})` gives that undefined value error despite that being defined...
return0e_ has joined #zig
return0e_ has quit [Ping timeout: 268 seconds]
<mq32> huh
<mq32> destination type '[2560]u16' has size 5120 but source type '[5120:0]u8' has size 5121
<mq32> embedFile will now spill an extra nul byte at the end?
mikdusan has joined #zig
<fengb> Just chop it off :P
<mq32> will not work, because then i'll lose array property
<mq32> which i will then not be able to bitcast into my target type :D
_Vi has quit [Ping timeout: 265 seconds]
<fengb> `@bitCast([2560]u16, @ptrCast(*[5120]u8, &src).*)`
<fengb> This is fine 🙃
<mq32> exactly this :D
<fengb> Actually... there's a @bytesToSlice
<mq32> doesn't work, as it's runtime only
<mq32> was my fist try
<fengb> Hmm
<ky0ko> so, i'm trying to compile zig on alpine linux and i'm getting undefined references to various functions such as clang::driver::createDriverOptTable() when it goes to link the binary
<ky0ko> does anyone have any troubleshooting ideas
<companion_cube> I thought discord already had some rust
<fengb> I think this was a targeted rewrite, mostly to get rid of the rogue GC
<fengb> ky0ko: I'm not familiar with Alpine, but maybe you can glean some ideas from the Docker build? https://github.com/ziglang/docker-zig/blob/master/Dockerfile
<ky0ko> hmm, it looks like its building llvm/clang from scratch instead of using the distro's packaged llvm9?
<SyrupThinker> A friend of mine successfully compiled with Alpine today :/
<SyrupThinker> But he also had trouble at first
<fengb> Hmm, I know they need to use the same compiler to be properly linked
<companion_cube> fengb: interesting post, thanks for sharing
<SyrupThinker> It worked for him compilin zig statically
mahmudov has joined #zig
<ky0ko> giving that a shot
wilsonk has joined #zig
<ky0ko> hmm. well now i get different undefined references
<metaleap> anyone got the new pkg-deps from #4343 working with multiple-libs + 1-exe? this super-minimized repro won't build the exe from proj3, with proj2 "not finding" proj1 (but build the libs alone without exe, no probs)
<ky0ko> redid the build and now it links, but then there's a segfault in the step after
johnLate has quit [Ping timeout: 250 seconds]
<ky0ko> make[2]: *** [CMakeFiles/zig_build_libuserland.dir/build.make:57: CMakeFiles/zig_build_libuserland] Segmentation fault
johnLate has joined #zig
<pixelherodev> So apparently my inline while loop wasn't sufficiently comptime
<pixelherodev> Seems to work now with `inline for (tuplearg) |s|`
mikdusan has quit [*.net *.split]
AlexMax has quit [*.net *.split]
BitPuffin has quit [*.net *.split]
fengb has quit [*.net *.split]
mixi has quit [*.net *.split]
tines9 has quit [*.net *.split]
BitPuffin has joined #zig
mikdusan has joined #zig
fengb has joined #zig
AlexMax has joined #zig
tines9 has joined #zig
mixi has joined #zig
bbrittain has quit [Ping timeout: 240 seconds]
bbrittain has joined #zig
bheads has joined #zig
<metaleap> comptime inline comptime while (comptime cond) :P
metaleap has quit [Quit: Leaving]
<pixelherodev> Yes. Brilliant solution.
<companion_cube> seems like we've been reading the same stuff
<fengb> :P
<companion_cube> interesting how people eventually come to "we need knobs in the GC"
<fengb> I'm curious if you could expose GC lifetimes to the user without making it complicated
<fengb> But at that point it's basically a bunch of fancy arenas >_>
<companion_cube> I think there was a variant of ML with "regions"
<novaskell> MLTon
<companion_cube> http://mlton.org/Regions :o
<companion_cube> TIL
<companion_cube> ah, wait, no
<companion_cube> it doesn't do that
<andrewrk> ky0ko, I'm guessing the clang library on alpine has been patched in a way that is incompatible with zig
<novaskell> though region inference is usually nice it (from the paper I read) still needs a GC for smaller heap objects. Mercury also comes with it as an experimental compile grade
<companion_cube> maybe I should give another try to SML…
<andrewrk> you can try a source build. the tarballs on ziglang.org/download for linux are actually built on alpine
<andrewrk> (but with llvm/clang from source)
<companion_cube> (I'd like decent IDE support though)
return0e_ has joined #zig
return0e_ has quit [Remote host closed the connection]
jjido has quit [Quit: Connection closed for inactivity]
Snetry has quit [Ping timeout: 260 seconds]
Snetry has joined #zig
<ky0ko> andrewrk, alpine does *very* little patching. it adds a triple for musl, enables stack protector by default, fixes shebangs in python scripts... and that's it
_Vi has joined #zig
<andrewrk> ky0ko, the file that has the error is copy-pasted from upstream clang into zig's source tree
Snetry has quit [Ping timeout: 248 seconds]
Snetry has joined #zig
metaleap has joined #zig
omglasers2 has joined #zig
Snetry has quit [Ping timeout: 268 seconds]
Snetry- has joined #zig
omglasers2 has quit [Client Quit]
omglasers2 has joined #zig
omglasers2 has quit [Client Quit]
ur5us has joined #zig
omglasers2 has joined #zig
<pixelherodev> Wait, Zig doesn't work on Alpine yet? Whelp, guess I'll wait a bit longer before switching over
<andrewrk> unclear. the downloads work on alpine and building from source works on alpine
<andrewrk> ky0ko's bug is not confirmed yet
ForLoveOfCats has joined #zig
<ky0ko> could it be possible that the issue is from alpine's packaged llvm/clang being 9.0.1
<ky0ko> (i am attempting a from-source build right now, fyi)
<pixelherodev> I'm using 9.0.1 I think...
<pixelherodev> Yeah
<andrewrk> ky0ko, yes. one thing to try would be upgrading those 3 files in zig's source tree to 9.0.1. if that is backwards compatible with 9.0.0 then it's a good solution. otherwise we have a bit of a tricky situation to solve
* novaskell is using zig on alpine
* pixelherodev thanks novaskell
<ky0ko> i've used alpine's own packaged 0.5.0 on alpine, but not current master, and that's what i'm trying to do
<pixelherodev> Good to know
<pixelherodev> 0.6 is meant for april, right?
<novaskell> 0.5.0+ab46713fa works somewhat (not tested as much as I'd like)
<pixelherodev> Could we do a 0.5.1 before that so distros can get a bit closer?
<andrewrk> which reminds me, I need to do some triaging and postpone some issues & bugs
<pixelherodev> Regarding GSoC: I'm guessing a self-hosted LLVM backend is just *slightly* out of scope? :P
<pixelherodev> (since I didn't get a response earlier)
bheads_ has joined #zig
<pixelherodev> Also, is zasm supposed to take Zig code and produce a raw binary?
bheads has quit [Ping timeout: 268 seconds]
bheads_ is now known as bheads
<andrewrk> zasm is just me learning how to write an assembler and deal with all the binary formats
<BaroqueLarouche> pixelherodev: I just added installRaw("filename.ext") to the Zig Builder
<pixelherodev> Ah
<pixelherodev> So would a self-hosted backend of some sort - whether self-hosted LLVM or using the self-hosted parser `zig fmt` uses - be in scope as a GSoC project?
<mq32> BaroqueLarouche, this sounds great!
<metaleap> can anyone tell me how people keep multiple side-by-side libs in their "zig projects dir", cross-importing each other, and make it work when it comes to a final executable?! addPackage and addPackagePath keep failing me for the dumbest plainest dummy multi-project repro setup.
<BaroqueLarouche> metaleap: maybe this is what you are looking for ? https://github.com/ziglang/zig/pull/4343
<andrewrk> pixelherodev, yes I think so
<andrewrk> it might not be mergeable verbatim, but would certainly benefit the zig project
<andrewrk> BaroqueLarouche, thanks for that PR :) I'm happy that we can stop depending on llvm-objcopy
<BaroqueLarouche> andrewrk: no problems, I'll work a bit on my GBA project and then submit more PR
<metaleap> BaroqueLarouche well see the issue posted earlier, linked at bottom likely, that references it. sadly the very nice feature doesnt make my stupid dumb trivial most-basal utterly-simpleton repro-repo build.
<metaleap> hence i was wondering.. how were people doing it before the feature
<BaroqueLarouche> andrewrk: like the issue linked here: https://github.com/wendigojaeger/ZigGBA/blob/master/GBA/bios.zig#L128
<BaroqueLarouche> but I would also like to work on an issue not related to my GBA project
<metaleap> i would troubleshoot it myself since it's zig stuff not c stuff but the trouble is, the full command it stitches together with nested --pkg-begin/ends looks just absolute correct
<andrewrk> BaroqueLarouche, if you want to solve that one, I would recommend to do this one first: https://github.com/ziglang/zig/issues/4335
<andrewrk> next https://github.com/ziglang/zig/issues/498, which will be a difficult task, but maybe that's what you want :)
<BaroqueLarouche> noting those issues
Akuli has quit [Quit: Leaving]
<metaleap> so here's my game-plan. instead of subfolders every of my zig libs has all its src files at the same root level as the build.zig. file names with dot-sep'd-segments indicate would-be-dir-paths. next, lib2 depending on lib1 will have its all its sources as symlinks inside its dir. so it goes for lib3 relying on both, and exe projs relying on all 3 for not just indirect but direct uses of those. this must be how everyone else is doing it? or nobody
<metaleap> maintains multiple libs? still trying to diagnose annoyingly-totally-fine-looking `--pkg-begin/end`s
<andrewrk> metaleap, did you see that you can explicitly set the root package path in build.zig? you could set all your libs to have the same package path as the dir that has build.zig
<Snektron> Oh man, that doesn't sound like the best way to handle libraries
<metaleap> andrewrk thx but i did not see that, tho i've ingested langref in full many times. how do i achieve this in short? dont fully grasp it tbh
<andrewrk> setMainPkgPath
<metaleap> Snektron: you dont say :P i'm aching to learn the better one
<metaleap> thx will dig
<andrewrk> Snektron, it'll be fine. we're slowly transitioning to zig package manager. it will be sloppy for a little while, and then it will be clear how to organize
<Snektron> Iirc the package thing was fine
<Snektron> But symlinking every source file seems like a good way to lose structure
<Snektron> And using dots instead of folders
<metaleap> andrewrk: i found it. no doc/comments so question: is this setting the "root" from which all relative paths specified will be resolved?
<metaleap> oh wait its a cli arg so maybe i find it under zig help
<andrewrk> metaleap, no, it's just what files are allowed to be used with @import
<andrewrk> it does affect compile errors I believe, when it says that a type name is a.b.YourType, "a" and "b" will be directories from the main pkg path
<ky0ko> the from-source build, with llvm 9.0.0, did *not* segfault
<metaleap> andrewrk "--main-pkg-path set the directory of the root package". so you have lib1/build.zig , lib2/build.zig, lib3/build.zig, prog1/build.zig. any of the libs have to import by name any of the others. and the prog all of them. whats "the directory of the root package" when i go zig build any one of them individually and the pkg-names will always resolve?
<andrewrk> multiple build.zig files isn't really supported yet, but that's https://github.com/ziglang/zig/issues/353
<andrewrk> there is no idiomatic way to do this yet. just get it working. it will be clear how to organize your project in a few months as the package manager starts to come along
<metaleap> ok. just mycodes/prog1/build.zig then. do i set main-pkg-path to the top-dir containing all the lib1 / lib2 / lib3 / prog1 / prog2 etc dirs side by side?
<metaleap> nobody ever had to do such a thing in the last ~2 years? :D
<andrewrk> hejsil and dbandstra have example projects you can look at for this
<metaleap> thx every pointer helps
zfoo has joined #zig
<mq32> metaleap: @intToPtr(*const u8, 0xFF00FF);
<mq32> take this!
<BaroqueLarouche> haha
<metaleap> teehee
<metaleap> found 13 code samples , yay https://github.com/search?q=setMainPkgPath&type=Code
cmrs has quit [Quit: ZNC 1.7.1 - https://znc.in]
cmrs has joined #zig
marmotini_ has joined #zig
marmotini_ has quit [Ping timeout: 240 seconds]
<metaleap> yay finally got it. no named pkgs anymore but at least now can cross-import across dirs / side-by-side repos without symlinks lol. plz dont kill setMainPkgPath kthx ^·°
<andrewrk> hmmm, dynamic_library test failing in the llvm10 branch
omglasers2 has left #zig [#zig]
marmotini_ has joined #zig
<dimenus> I hate c/c#'s behavior with switch/break
<dimenus> it's a compilation error to fall through to the next case, but then they still require 'break' anyway
<mq32> dimenus, in C# you can chose to `goto label foo;`
<mq32> for manual, very controlled fallthrough
<dimenus> i don't want fallthrough, i'm just annoyed that it still requires break even though there is no fallthrough
<dimenus> zig's behavior is much better :)
<mq32> but that's the point ;)
<mq32> c# allows both fallthrough AND break
<mq32> which zig doesn't
<dimenus> wait, it allows fallthrough without the goto?
<mq32> no, you are required to use the goto
<mq32> but it's a thing about clarity ;)
<mq32> a switch prong either gotos or breaks
metaleap has quit [Quit: Leaving]
frmdstryr has joined #zig
gonz_ has joined #zig
ur5us has quit [Ping timeout: 265 seconds]
<frmdstryr> Is there anything like python's range() ?
<frmdstryr> for (0..10) |i| { ...}