Roadmap

Sun Language Roadmap

Features Sun still needs, ordered by priority — highest first. Completed features are removed from this list rather than ticked off.

The guiding principle: prioritise the work that turns "wait for the compiler team" into "a user can do it themselves". Table stakes before novelty.


1. Optionals — Remaining Work

Option<T> / Result<T, E> ship in the stdlib (stdlib/option.sun) as ordinary generic payload enums with owning payloads and drop glue. The absence APIs (Map.find, String.find_char/rfind_char, Vec.first/last/pop, LinkedList.first/last) return Option<T>, and the iteration protocol (stdlib/iterator.sun) is next(ref Container) Option<T>. What remains:

  • Niche-optimised representation where possible (e.g. Option<raw_ptr<T>> as a nullable pointer)
  • Bare Some / None prelude names (today it is Option.Some(x) / Option.None)
  • Explicit Option<i32>.Some(...) in expression position
  • Nested-generic payload unification
  • Moving a payload out of a match binding (needs partial-move tracking; today compound bindings borrow the payload slot by pointer)
  • Arrays and globals of payload enums
  • C-ABI classification of payload enums
  • Nested patterns in match
  • DW_TAG_variant_part debug info for payload enums

2. Constants and Compile-Time Evaluation

Routine requirements in embedded and safety-critical work, not niceties.

  • Compile-time evaluation of constant expressions (const variables, const ref and const function exist; a const global is still initialised at runtime)
  • Const generics: array<T, const N>
  • Fixed-size array types

3. Iteration Ergonomics

for (var x: Type in iterable) works but requires an explicit type annotation and there are no adapters. Verbose iteration is the first thing people mention when they bounce off a language.

  • Infer the element type in for ... in
  • Iterator adapters (map, filter, take, zip, enumerate)
  • Ranges as iterables
  • Iteration over a constant container: next(ref Container) takes a mutable borrow, so for … in needs a var iterable

4. Language Server Navigation

The LSP serves diagnostics, formatting, semantic tokens and hover type information today, plus a VS Code extension in extensions/vscode-sun. The navigation features are the gap.

  • Go-to-definition
  • Find references
  • Hover type info, with the comment above the symbol's declaration. Inside a generic body the types come from the first specialization, printed in terms of the type parameters; a generic that is never used only shows its written annotations.
  • Autocomplete (must hide items that are not accessible from the cursor's module — use sun::access::isAccessible)
  • Rename symbol

5. Testing

There is no sun test; the suites under tests/ are GoogleTest in C++. Users cannot write tests in Sun, which suppresses exactly the library-writing that an ecosystem is made of.

  • sun test runner
  • Test declarations in .sun source
  • Assertion builtins with useful failure output

6. Error Handling Improvements

  • Stack traces on errors
  • panic / assert builtins
  • Error context and chaining

7. Library Expansion

Roughly 5,000 lines of stdlib today. Files and directories (sun.io), environment (sun.env), processes (sun.process) and clocks (sun.time) all exist. Every item below is something a first-day user hits. Most are community-supplyable now that FFI has landed.

  • Regex (expose the existing parser)
  • extern declarations for C globals — needed for environ, and so for listing every environment variable
  • File metadata beyond exists/size, via statx (the one stat-family call whose struct has the same layout on every architecture)
  • Buffered stdin; sun.io.read_line reads a byte at a time so it cannot swallow input a child process is about to read
  • String.c_str() as a const function: it writes the terminating NUL on demand, so every path-taking function (sun.io, sun.env, sun.process) still takes ref String. Keeping the NUL as an invariant of the buffer would let them take const ref String

8. Data Structures

Vec<T>, Map<K, V>, LinkedList<T>, ContiguousBuffer<T>, String, Matrix<T> and Unique<T> exist today.

  • Set<T>
  • Queue<T>, Stack<T>
  • OrderedMap<K, V>

9. Language Odds and Ends

  • Interface inheritance (src/semantic_analysis/scope_variables.cpp:746)
  • Explicit enum values: Red = 1 (src/parsing/parser.cpp:3367)
  • More sophisticated borrow tracking for ref params (src/borrow_checker/borrow_checker.cpp:299)
  • Proper i64 helper and float printing in src/codegen/call_expressions.cpp:1745 / :1766

10. Other Tooling

  • Linter (sunlint)
  • Source maps for error traces
  • Re-enable the 11 DISABLED_ tests in tests/tooling/frontend/test_lexer.cpp, tests/stdlib/test_matrix.cpp, tests/stdlib/collections/test_linked_list.cpp

11. Native Protobuf Import — Deferred Items

protos: manifest imports synthesize Sun source per message (encode/decode, _delimited framing, Option<T> for proto3 optional, payload enums for oneof, unknown-field preservation, .moon export), byte-identical to libprotobuf. Docs: docs/pages/protobuf.mdx. Deferred:

  • proto2 syntax
  • group
  • Extensions
  • Recursive messages by value (need indirection)
  • --dump-proto-sun in the LSP

12. WebAssembly Target

  • WebAssembly — also the cheapest route to an online playground, which is the most effective adoption funnel a new language has

13. Robotics Middleware

Robotics systems are dozens to hundreds of processes communicating over a DDS through a pub-sub middleware. Sun ships the message layer (native protobuf import); the transport is the gap.

  • Custom DDS: discovery, topics, QoS, and a wire protocol
  • Pub-sub middleware on top of it, with protobuf messages as the payload
  • Interop with existing DDS implementations and ROS 2

14. Hardware Accelerators

Matrix<T> and linear algebra run on the CPU today. The design goal is builtin GPU/accelerator support without leaving the language.

  • Offload kernels via LLVM Offload
  • Device memory ownership modelled by the borrow checker
  • Matrix<T> operations dispatched to the device when available

15. Tuples (maybe)

Under consideration, not committed to.

  • Tuple types: (i32, string)
  • Tuple construction: (1, "hello")
  • Destructuring: var (x, y) = pair;
  • Multiple return values without a named class

Open Design Decisions

  1. FFI lifetimes: extern calls require an unsafe block, and the convention is a safe Sun wrapper around it. What remains undecided is whether the borrow checker should model a pointer escaping into C at all — today ref T hands C an address with no lifetime tracking across the call.
  2. Generic instantiation: where do cross-module instantiations get emitted, and who owns deduplication — the compiler or the linker? (Today: use-site instantiation with link-time deduplication.)
  3. Memory model: should Vec<T> own its allocator or take a reference?
  4. Protobuf surface: import-only (.proto via manifest) shipped first. A native message declaration in Sun source with field: T = tag; syntax remains open — it would drive the same source generator (ProtoImporter) from a parser production instead of a FileDescriptor.

Last updated: August 2026