Leaf
write beautiful programs

Development Status

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 (lacks inheritance)
  • conditionals – working (ternary syntax) (Understanding Leaf conditionals)
  • overloads – working (selectables)
  • shared variables – working
  • return and cleanup – working
  • closures – working
  • arrays – basic
  • loops – while loop
  • strings – minimal array (string type)
  • errors - basic (modelling flow)
  • linking / standalone – working, including C libraries
  • type conversion – working (tuples)
  • type unification – working
  • out-of-order type resolution – working
  • external functions – working
  • ctors/dtors – not ctor params yet
  • iterators - (rudimentary for loop)
  • 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
  • modules - (execution model)
  • parametric functions/ classes - 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.

Standard Library

Perhaps the biggest element of the Leaf environment that is missing is a standard library. Despite all the above features it really isn't practical to use yet. The current focus of development is towards creating a rudimentary library so at least basic tasks are possible.

Creation of a standard library and simple tools is what decides the direction of the language at this time.

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.

It's actually uncertain whether inheritence is the right model to follow. A system of interfaces and mixins may be a better, more versatile approach.

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 mechanism is essentially available now: generic errors can be generated. No data can yet be associated with the errors.

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.

A very limited type_infer is available now to extract types from expressions.

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.