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
Operators
- Basic arithmetic,
+,-,*,/, comparisons, etc. - Pipeline operators
|>and<| - Assignment
:= - Compound assignment operators
+=,-=,*=,/=,%= -
.Field access -
.Method calls -
<-Wrapping the rest of the block in a function (often for applying effect handlers) -
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 -
extern
Types
- Global type inference (HM)
- Product and sum (struct and enum) type definitions
- Type aliases
- Type annotations
- Implicits
-
implicitlocal variables -
implicitparameters - Querying implicit values required for a function call
- Calling implicit functions in scope for their return value (required for traits)
- Check to ensure only
pureimplicit functions can be called
- Check to ensure only
-
- 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
- Cranelift backend
- Existentialization option for lowering generics in debug mode (making monomorphization optional)
- Compiler option to write inferred types into the file
- Formatter
- Language server.
- Display errors in file
- Hover
- Display documentation on hover
- Go to definition
- Go to type
- Rename
- Import symbol
- Fill in match arms
- Vim plugin
- VS-Code plugin: One exists but it is not hooked up to the language server and its syntax is out of date
- 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
Effects
- Type checking
- Runtime
- Handlers
- Handlers for a single effect
- Handlers for multiple effects
- Handlers for multiple instances of the same effect (e.g.
Emit a, Emit b)
-
resume- Single resumptions
- 0 resumptions
- Capabilities
- Capabilities are second-class
- Handlers