mirror of
https://github.com/luau-lang/rfcs.git
synced 2025-05-04 10:43:48 +01:00
Clarify motivations
This commit is contained in:
parent
3bcd3f0383
commit
321c18cdda
1 changed files with 17 additions and 8 deletions
|
@ -2,19 +2,28 @@
|
||||||
|
|
||||||
## Motivation
|
## Motivation
|
||||||
|
|
||||||
- Cross-runtime automated testing
|
- Many patterns utilize current dynamic requires, or load in luau files manually:
|
||||||
- Auto-requiring ecs systems
|
- ECS systems
|
||||||
- Commands for things like discord bots
|
- The "service" pattern
|
||||||
- Module loaders in general
|
- Module initializers
|
||||||
- Type safety (even if it's typed to be unknown, it's better than typecasting to any.)
|
- Tests
|
||||||
- Cyclical dependency reporting
|
- The alternative (writing out manual requires) is quite cumbersome and not feasible to expect developers to do
|
||||||
- This would be required for static cross-compilation or whatever the term is
|
- 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
|
## Design
|
||||||
|
|
||||||
- directory/\*\* for descendants
|
- directory/\*\* for descendants
|
||||||
- directory/\* for children
|
- directory/\* for children
|
||||||
- Alphanumeric ordering
|
- Alphanumeric ordering off file name
|
||||||
|
- file1
|
||||||
|
- file12
|
||||||
|
- file13
|
||||||
|
- file2
|
||||||
|
- file31
|
||||||
|
- file3
|
||||||
|
- "File name" does not include extension!
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local children = require("directory/*)") -- array
|
local children = require("directory/*)") -- array
|
||||||
|
|
Loading…
Add table
Reference in a new issue