I actually wish we could have multiple modules in a single file. Correct me if I'm wrong, but if imported something and only used one type there, the linker should strip out the others, right?

But this doesn't happen because ModuleInfo references all kinds of things, and moduleinfo is referenced for constructors and such. This is useful and removing it is probably a bad idea.

Breaking up into packages is one idea but you can't always do it. What if you're doing some big string mixins? A single file is also a little easier to distribute.

But mixins is the case that is hard to work around since they by definition go into one file. If we could do something like mixin("module foo.mixin"~name~" { code }"); you could work around it.

Then you could isolate sections of generated code in their own logical modules, letting the linker kill those sections if they aren't actually used.

Reply via email to