Roadmap

2022-06-25

This page is for an in-depth roadmap of ante to show what is currently implemented in the compiler. Note that the basic compiler passes from lexing, parsing, etc through (llvm) codegen have been implemented for quite some time so readers can assume the basic inner workings of the compiler are working.

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

Literals

All literals are implemented except for:

  • [~] 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.

Operators

  • Basic arithmetic, +, -, *, /, comparisons, etc.
  • Pipeline operators |> and <|
  • Assignment :=
  • . Field access
  • +=, -=, *= and friends
  • Bits module - There are bnot, band, bor, and bxor functions in the prelude however.

Functions and Control Flow

  • Functions + lambdas
  • Explicit currying
  • if
  • [~] match and 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 -> ...
  • loop sugar
  • Iterator trait in prelude
  • extern
  • C module in stdlib to move extern C functions and types to, they are currently in the prelude.

Types

  • Global type inference (HM)
  • Product and sum (struct and enum) type definitions
  • Type aliases
  • Type annotations
  • Traits
    • Restricted Functional Dependency clause (->). Equivalent to associated types.
  • Polymorphic Int and Float types for polymorphic integer and float literals
    • Defaulting to I32 and F64
  • [~] Row polymorphic struct types. Implemented internally, except for:
    • Allow users to specify these in type annotations. They are currently only inferred.
  • [~] Trait impls
    • Given clause
    • Named impls
    • Impl search
    • Static dispatch of traits

Modules

  • Basic module hierarchy
  • Relative roots. This refers to the ability to refer to Vec.push defined in stdlib/Vec.an even though there is no Vec module strictly in the directory you’re in.
    • Adding arbitrary new relative roots to refer to imported libraries used within a project. This will likely need to wait until a package manager is ironed out.
  • [~] Import all visible symbols from a file. This uses the syntax import Vec instead of import Vec.* currently but is otherwise implemented.
  • [~] Importing only select symbols from a module. This uses import Vec.foo bar currently instead of import Vec.foo, bar
  • Renaming imports
  • Hiding imports

Compiler-specific

  • LLVM backend
  • Cranelift backend
  • Compiler option to write inferred types into the file
  • [~] Language server.
    • Display errors in file
    • Hover
    • Go to definition
    • Go to type
    • Rename
  • Unused variable warning message
  • Parser recoverable on error
  • Name resolution recoverable on error
  • Type system recoverable on error

Ownership

Ante’s ownership and borrowing rules have been completely redesigned recently. They will take some time to implement.

  • Mutating owned values. This currently still uses the old Ref t type for a boxed, mutable value similar to OCaml’s t ref.
  • Tracking moves and issuing errors when a moved value is used
  • Borrowing
    • Basic immutable and mutable borrowing
    • Preventing moving owned values while the borrowed reference is alive
    • Reference lifetimes and conversions
    • shared and owned modifiers
    • ref qualifier for types which store references

Other

Algebraic effects are currently in development in a branch. Some basic programs are working but the feature overall is still experimental and causes panics in most programs. For now, only type checking of effects is in master.

  • Algebraic effects
    • Type checking
    • Runtime
      • Handlers
        • Matching on effects
        • Matching on return values
      • resume
        • Single resumptions
        • Multiple resumptions
        • 0 resumptions