summaryrefslogtreecommitdiff
path: root/doc/goals.txt
diff options
context:
space:
mode:
Diffstat (limited to 'doc/goals.txt')
-rw-r--r--doc/goals.txt62
1 files changed, 62 insertions, 0 deletions
diff --git a/doc/goals.txt b/doc/goals.txt
new file mode 100644
index 0000000..620438c
--- /dev/null
+++ b/doc/goals.txt
@@ -0,0 +1,62 @@
+a loose collection of goals and ideas for this as-yet-unnamed language
+
+* fast compilation
+ + grammar must be very easy to parse
+ + more important than high performance
+ + more important than minor ergonomic sacrifices
+ + possibly built-in hot code reloading somewhere down the line
+ + in general:
+ - the most important thing for coding to be fun is a tight feedback loop
+
+* very small, self-contained executables
+ + hello world should ideally be on the order of a couple kilobytes
+ + only functions which get referenced from main (and so on recursively)
+ get any code generated, even for the stdlib
+ + favor size over performance where reasonable
+
+* explicit
+ + procedures that allocate should have an arena parameter
+ + no operator overloading, but builtin vector/matrix types (eventually)
+
+* aesthetically minimalist
+ + not too many keywords or features
+ + no semicolons
+ + no significant whitespace
+ + no parentheses around conditions
+ + type inference wherever possible
+
+* more modern type system than c
+ + distinction between pointers and arrays
+ + slice types (ptr, len)
+ - strings are slices, like rust &str or c++ str_view
+ + dynamic arrays (ptr, len, cap)
+ - manipulation of dynamic arrays is handled by normal functions
+ + type-safe generics
+ + parametric polymorphism (at compile time)
+ + built-in types for vector and matrix math
+ + scalar types have explicit bit sizes
+ - u8, i32, u64, f32, f64
+ + bit set support!
+ + type inference
+ - let x = y
+ - can do like .ENUM_NAME when expecting an enum value, even though
+ otherwise it's `let x = EnumType.ENUM_NAME`
+
+* c interop
+ + ability to specify different calling conventions on:
+ - functions imported from outside
+ - functions exported
+
+* types and procedures in any order
+ + this goal can be thrown out if it turns out to slow down the compiler
+ - but finding these first allows to hand all procedures to a thread pool
+ for parsing and optimization
+ + removes the need for function prototypes, opaque structs, etc.
+ + like in odin, all files in a directory are compiled together and have
+ the same toplevel scope; to isolate things in a package, put them in
+ a different directory
+
+* portable
+ + should be as easy as possible (like that's saying much...) to port to new platforms
+ + at minimum support amd64 and wasm
+ + consider having a version of the compiler which uses LLVM for release builds