Cannot import from sibling directories

I have a large project that has a couple directories that are utilities, and want to have a hierarchy for them without polluting the top level name space with basically everything.

src
src/collections/hash
src/collections/veb
src/net
src/coroutines

but there is also

src/debug/assert
src/debug/print

I can’t @import the debug stuff from the collections.

Some of the debug stuff relied on the collection stuff (such as a fixarraylist or fixedstrintg) but those also use the debug asserts.

I currently imporrt EVERYTHING with a src/_all.zig file that I generated with an awk script. Thais’ horrible.

I can’t @import the debug stuff from the collections.

What error are you greeted with? Or is it a personal problem you have with it?

You can create internal modules using:
createModule and addAnonymousImport

exe.root_module.addAnonymousImport(
    "debug", 
    .{ .root_source_file = b.path("src/debug.zig") },
);
2 Likes

Would’ve been by solution guess too…

I recently made a similar recommendation: Importation and dependencies - #14 by dude_the_builder

Oh and

straight to jail. lol

3 Likes