From 4259039bb8fa7b9ec98225022841e2bb3bb1d639 Mon Sep 17 00:00:00 2001 From: Daniel P H Fox Date: Sat, 19 Aug 2023 17:41:43 +0100 Subject: [PATCH] Final tweaks --- rfcs/syntax-static-imports.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rfcs/syntax-static-imports.md b/rfcs/syntax-static-imports.md index 6b7301e9..cfed48ae 100644 --- a/rfcs/syntax-static-imports.md +++ b/rfcs/syntax-static-imports.md @@ -1,4 +1,4 @@ -# Static imports +# Static import syntax ## Summary @@ -268,6 +268,8 @@ Statically evaluated statements might feel 'out of step' with Lua's dynamic natu The extensions to the `!import` syntax, such as renaming or destructuring, may be seen as a measurable increase in complexity from what was previously a simple and predictable operation. Depending on the syntax and keywords used, these extended features may run the risk of confusing newer users, or making the way code is imported less immediately clear. +While efforts have been made to align this feature to the kinds of analysis already done internally by Luau's tooling, it undeniably still introduces internal complexity. Even though these statements are more explicitly designed for static analysis and useful type inference compared to the more dynamic and unpredictable `require()`, backwards compatibility concerns mean that the more complex logic for detecting `require()` usage still needs to be maintained, and cannot be removed even if it were to be superseded by a more predictable form. In addition, some of the extended importing features are novel, and do not correspond to existing language features, which introduces new internal considerations that were not present before. + ## Alternatives `local import`, `import in`, `do import` or some other two-keyword form would also allow the declaration of these statements after user declarations. While this looks more stylistically in-line with existing statements and still preserves backwards compatibility, this seems unwieldy and bulky, and depending on keyword choice, could introduce confusion with the extended features of the statement or may contradict how the keywords are used elsewhere.