Skip to content

2024-November-2

Latest
Compare
Choose a tag to compare
@ForLoveOfCats ForLoveOfCats released this 02 Nov 22:04
· 7 commits to main since this release

Fae 0.0.1-1bb34fb-bunded
Built on November the 2nd 2024

Improvements

  • Replaced the use of double-colon :: with a period . as module path separator or enum variant specification in type position.

Detailed Discussion

This release completely replaces the use of :: in Fae code with the period . and cleans up a bunch of syntactic inconsistencies along the way. The compiler now reasons about symbol, variant, field, and method lookup entirely differently and many previously un-parsable situations are now entirely valid.

Most in-scope symbols already existed within a unified namespace so removing the concept of a "module path" vs a "dot access path" and unifying the two is very natural.

Importing a symbol

// Old
import fae::collections::list::List

// New
import fae.collections.list.List

Calling a non-imported symbol

// Old
fae::io::terminal::clear()

// New
fae.io.terminal.clear()

Previously an enum variant was initialized with a dot Enum.Variant but in type parsing had to be referred to via a double colon Enum::Variant to avoid syntactic ambiguity. This is now resolved and uses a dot everywhere.

Dot inferring an enum variant based on context previously allowed calling instance methods but not static methods; this has been resolved with this overhaul.

// Old
function(Enum::Variant.static_method())

// New
function(.Variant.static_method())

A minor change resulting from this overhaul is that type arguments to enum variant initialization is now placed on the enum name rather than the variant name. This was not a goal of the refactor but is logically consistent with how the compiler reasons about variants and as such is acceptable.

// Old
let _ = Enum.Variant<i32> { field: 42 }

// New
let _ = Enum<i32>.Variant { field: 42 }