Here is a rough list of the status of several completed and planned features for Leaf. This is by no means a list of the final intended features, nor are any of the current features in their final form. It’s mainly just a way for me to track and plan my progress. The status here may sometimes lag behind what is actually available in the code.
- basic types – working
- tuples – working
- class types – basic (lack inheritance)
- conditionals – working (ternary syntax)
- overloads – working (selectables)
- shared variables – working
- return and cleanup – working
- closures – working
- arrays – basic
- loops – while loop
- strings – minimal array<char> (string type)
- exceptions – basic test (modelling flow)
- linking/standalone – basic multiple files
- error reporting – very limited
- type conversion – working (tuples)
- type unification – working
- out-of-order type resolution – mostly working
- external functions – limited
- ctors/dtors – not ctor params yet
- iterators
- const folding – essential only
- const/readonly types
- optional variables – working
- default/optional parameters – working
- abi value_ptr – working
- rationals / fixation – working (1/2 != 0)
- lossy conversion – working
- type aliases – working
What’s Missing Now
These are the major areas that need work before Leaf could be considered usable to some degree. A standard library is not included here and will simply be built as required.
Modules
Basic multi-file compilation is possible thanks to out-or-order type resolution. The next step is to produce actual libraries. The easier of shared or static library will be done first. Most of the work will be in loading/saving Leaf specific type information. There are a lot of open questions about scope, especially regarding overloads.
Class Inheritance
Initially basic inheritance will be targeted. This will need to address the scoping rules as well as basic memory layout. Afterwards virtual interfaces will be added. That will mainly be a question of layout, and dynamic behaviour of virtual tables/types.
Parametric Types/Functions
The realm of templates and generics. The basics start with parametric functions which work on arbitrary parameter types. Following this are the container classes. This is actually an extension to the type inference system.
Macros
Actually only one of a macro system or parametric types is required to be a usable language. The macro system will be very structured, not a raw source based substitution. Macros allow for creating fake generics, as well as reducing a lot of structural code.
Error Handling
Leaf will have a unified method of error handling. It will be one of its most experimental aspects, though based on a lot of experience.
The Future
These are the features that I think are required to make a great language, but are not required to have a functioning language. I will thus attempt to start making real programs in Leaf before these are available.
Meta-Programming
This is an extension to the parametric types and functions. This includes things like compile-time traits, conditional expansion, and possibly also compile-time expression evaluation.
Sub-typing
This is a generic mechanism which gives units to types. The typical units are the physical axes like distance, time, energy, etc. For a document example this could be encoded strings or HTML attributes. To improve security it would also allow marking data as clean, or raw user input.
Mixins and Delegation
An extension to the class system which allows flexible building of classes which implement various interfaces.
Type Inspection
The type system is exposed to the code. This is related a lot to meta-programming, but also allows several other features. Part of this will be runtime type information for the support of dynamic types.