Sona is a general-purpose programming/scripting language targetting .NET and powered by F#. It draws inspiration from several .NET languages, as well as Lua, to offer simple yet powerful syntax with focus on clarity and utility. Despite its primary paradigm being imperative, it utilizes many features found in functional programming languages, such as first-class functions, tuples and records, as well as powerful type inference.
For a full overview of its features, please see the wiki. The main distinguishing features are:
- Expressive syntax primarily inspired by Lua, including:
- Focus on keywords rather than operators to indicate special syntax elements and constructions.
- Semicolons are optional; whitespace is insignificant.
- Simplicity and consistency:
- Overloading is favoured over explicit syntax, such as
..being used to concatenate strings, lists, or sequences;&,|,>>and<<are used both for functional and bitwise manipulation, and so on. - Parity between expressions and types: the type of
function(x as string)isfunction(string); the type of(1, "x")(a tuple) is(int, string), etc. - Conversion operators do not require familiarization with spatial metaphors in type theories:
narrow x/widen xare used to convert to a more/less derived type, respectively.
- Overloading is favoured over explicit syntax, such as
- Imperative constructs (
return,break,continue) are built on functional principles, maintaining convenience without sacrificing soundness. - Built-in option type (
?), usable in constructions (some x,none), conversions (int? x,narrow? x), the coalesce operator (x ?? y), or conditional member access (?.). - Built-in sequence type (
..), easily constructible using{…}(e.g.{x, ..anotherSequence, y}, supporting the spread operator). - Type-tested formatting in interpolated strings:
{x:0.0#}implies a numeric type;{x:ddMMyy}implies a date.
To report and track bugs, please use the associated issues page. For discussing the language or its features, please use Discord.
The language and associated tooling is currently in the initial development phase. During this phase, features are expected to be added, modified, or removed as the design decisions and implementation considerations shape the language, until version 1.0. Since the language is not considered stable at this point, you are welcome to try all its features, but please be cautionary when incorporating them into existing solutions.
The project is available as a stand-alone release, containing both the compiler and a playground environment. The compiler is also available as a .NET tool, and may be embedded as a service in other solutions as a NuGet package.
During the initial development, the project is built and tested using .NET 8+, and multi-targeted for .NET Standard 2.0. The compiler and runtime rely on the latest version of F# to properly function ‒ using the intermediate output in an older version of F# may lead to errors.
The project uses semantic versioning: