2022-06-25
Ante’s compiler has recently finished a complete rewrite and is now incremental, concurrent, and fault-tolerant - although general performance still has much room for improvement.
This page is for an in-depth roadmap of ante to show which features are currently implemented in the compiler.
All designs in the ideas page are not implemented as their design is still non-final and may not be selected at all.
Key:
- Implemented
- [~] Partially implemented
- Not implemented
Note that since the compiler is still immature, a feature marked as implemented may not be completely bug-free or may have some unimplemented corner cases. These are not expected however, and users encountering any bugs with these features should create an issue on github.
Literals
- Polymorphic integers (defaulting to
I32) - Polymorphic floats (defaulting to
F64) - Unit literal
() - Bool literals
trueandfalse - Strings
- [~]
Char- implemented but is 1 byte rather than 4. There is an open design question of whether ante should use Rust’s model for chars (4 bytes), Swift’s model (variable bytes), or something else. These also use a temporaryc"_"syntax currently. - Array literals
- Slices
Operators
- Basic arithmetic,
+,-,*,/, comparisons, etc. - Pipeline operators
|>and<| - Assignment
:= - Compound assignment operators
+=,-=,*=,/=,%= -
.Field access -
.Method calls - these may change in the future due to the conflict with struct field access -
isoperator for pattern matching withoutmatch
Functions and Control Flow
- Free functions
- Closures
- Explicit currying via
_ - if
-
matchand pattern matching- Variable/match-all patterns
- Constructor patterns
- Integer literal patterns
- Completeness & Redundancy checking
- ‘Or’ clause in pattern matching, combining patterns via
| - Pattern guards:
| pattern if expr -> ... -
iskeyword for matching within expressions
-
loopsugar -
forloops -
whileloops -
break/continue
Types
- Global type inference (HM)
- Product and sum (struct and enum) type definitions
- Type aliases
- Type annotations
- Kind inference
- Implicits
-
implicitlocal variables -
implicitparameters - Querying implicit values required for a function call
- Calling implicit functions in scope for their return value (implicits like
eq_maybeare functions since they require other implicits as parameters)- Check to ensure only pure implicit functions can be called
- This was the original design but has been made more difficult by the move to capabilities
- Check to ensure only pure implicit functions can be called
-
- Trait sugar to create a dictionary type of the required functions
- Trait impl sugar for implicit values which is an instantiation of the trait type
- Row polymorphic struct types
Modules
- Basic module hierarchy
-
importone or more symbols from a module -
exportonly a subset of symbols from a module - Renaming imports
- Re-exports
-
import implicitfor introducing implicit values. Currently these use a normalimportstatement.
Stdlib
All APIs are non-final.
-
Preludemodule auto-imported into each file- Opt out of importing prelude into a given file or project
-
Cmodule in stdlib for C interop -
Vec: Mutable, growable vectors -
HashMap -
Seq: Persistent vector with O(1) pop, get, and clone, and amortized O(1) push. -
Rc - [~]
String: Methods lack any kind of UTF-8 verification - [~]
IO: Existing module is extremely bare bones. -
Stream: TheEmiteffect andStreamtrait for push-based streams. -
Fail: Effects for generic failure & throwing a specific value - Others: Help wanted! Designing which modules the stdlib should include
Compiler-specific
- LLVM backend (optional but preferred)
- C backend
- Cranelift backend
- Existentialization option for lowering generics in debug mode (making monomorphization optional)
- Compiler option to write inferred types into the file
- Formatter
- Platforms
- Interfaces for common platforms defined
-
IOinterface defined- The compiler uses
externdeclarations currently not in its design and relies on Posix symbols
- The compiler uses
- Linker provides values for platform parameters to
main. - Linker provides values for dynamic library parameters to
main.
- Language server.
- Display errors in file
- Hover
- Display documentation on hover
- Go to definition
- Go to type
- Rename
- Import symbol
- Import implicit
- Fill in match arms
- Vim plugin
- VSCode plugin
- Recoverable on error
- Compiler only rechecks changed code in incremental mode
- Disabled by default since it requires storing metadata for the project, enabled for the language server
- Concurrent
Ownership & Mutation
-
varfor local mutable variables - Mutating owned values and mutable references to values.
- Move tracking
-
Dropcalled after a variable’s last non-move use-
Drop-unwinding for uncalledresumes when handling effects.
-
-
Copyexempting variables from moves - Borrowing
-
ref,mut,imm, anduniqreferences exist -
immanduniqcannot coexist withrefandmutto the same value -
uniqcannot coexist with any other reference to the same value - Moves are prevented while any reference to the same value is alive
- Lifetimes are checked
-
-
sharedmodifier on types
Abilities
- Type checking
- [~]
implicit foo = bardefinitions- Implemented but they can cause infinite loops in the type checker at top-level when used with mutual recursion.
- The old
impl foo: Bar with ..form is still included with some hacks to resolve the above loops and will be removed eventually.
- Hidden
envparameter- Abilities are structs of closures which may capture values in their environment unboxed.
- This is implemented but the representation will change in the future.
- Runtime
- Effect Handlers
-
resume- Single resumptions
- 0 resumptions
- Tail-resume optimization
- [~] 0-resume optimization
- A form of this is implemented but its design is broken since it will skip drops in the future once drops are auto-inserted by the compiler.
- Capabilities
- Capability-based Security
- No
IOeffect yet. Other effects are handled as normal but users can escape these restraints by definingexternsymbols which link to library code performing arbitrary effects.
- No
- Capability-based Security