diff --git a/docs/require-by-string-glob-imports.md b/docs/require-by-string-glob-imports.md index 6c67fd9..2d504b2 100644 --- a/docs/require-by-string-glob-imports.md +++ b/docs/require-by-string-glob-imports.md @@ -2,19 +2,28 @@ ## Motivation -- Cross-runtime automated testing -- Auto-requiring ecs systems -- Commands for things like discord bots -- Module loaders in general -- Type safety (even if it's typed to be unknown, it's better than typecasting to any.) -- Cyclical dependency reporting -- This would be required for static cross-compilation or whatever the term is +- Many patterns utilize current dynamic requires, or load in luau files manually: + - ECS systems + - The "service" pattern + - Module initializers + - Tests +- The alternative (writing out manual requires) is quite cumbersome and not feasible to expect developers to do +- Cross-runtime/platform automated testing is currently impossible +- Current dynamic requires are not type safe and can have cyclical dependency errors which are not picked up on. This isn't a conceptual limitation, it is totally possible to report. +- Cross-module compilation may be wanted in the eventual future. But this pattern is common and will not be going away. There should be a way to express "requiring all children of a directory" while still having full cross-module compilation. ## Design - directory/\*\* for descendants - directory/\* for children -- Alphanumeric ordering +- Alphanumeric ordering off file name + - file1 + - file12 + - file13 + - file2 + - file31 + - file3 +- "File name" does not include extension! ```lua local children = require("directory/*)") -- array