small updates and thoughts
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 11 May 2021 19:01:12 +0000 (14:01 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 11 May 2021 19:01:12 +0000 (14:01 -0500)
docs/module_thoughts [new file with mode: 0644]
src/onyxchecker.c

diff --git a/docs/module_thoughts b/docs/module_thoughts
new file mode 100644 (file)
index 0000000..592da54
--- /dev/null
@@ -0,0 +1,27 @@
+Modules in Onyx
+---------------
+
+Modules are going to be the form of reusable code in Onyx. They should be a
+self-contained (maybe dependent on other modules), collection of Onyx files
+with a module.onyx in the root folder that loads all relevant files to the
+module. Modules can then easily be included by loading the module.onyx file
+of any module.
+
+Things that need to be decided about modules:
+    - How should modules be searched for in the filesystem?
+    - How should javascript code in modules be easily maintained?
+        Current solutions just copy the relevant javascript on build.
+
+Things that need to be done in the compiler:
+    - Rename 'package' to 'namespace'
+        I think 'namespace' better reflects the way I think about 'packages'.
+        I don't want it to feel too 'C++-y' but I think the nomenclature change is worthwhile.
+
+        'package' was orginally inspired by Java, but there the folder structure must match
+        the package structure. In Onyx, that is not the case because it allows for packages
+        to be extended on without needing to modify the source of the original package.
+
+    - Add relative file loads and relative #file_contents.
+        If the string starts with './', it should be considered relative.
+        This will make it easier for modules to include their files, regardless of
+        how the project is set up.
index cbae99bdea112d952617905108d06effe18b9da1..404e2a771bd8d484d9261ba3785466d4a521bcf0 100644 (file)
@@ -1010,6 +1010,9 @@ CheckStatus check_struct_literal(AstStructLiteral* sl) {
     AstTyped** actual = sl->args.values;
     StructMember smem;
 
+    // BUG: There are problems setting the comptime flag this late in the checking because
+    // if the struct literal was type inferred, then the literal won't be correctly determined
+    // to be comptime on the first pass, which is needed for top level expressions.
     sl->flags |= Ast_Flag_Comptime;
 
     fori (i, 0, mem_count) {