This post is a follow up of a post introducing Yatta language, providing an update on the recent development.
First thing that needs to be addressed is the change of the name. Sadly, Yatta is a registered trademark and therefore the language needed a new name. As of now, the language is called Yona.
As we are working towards the beta release of the language, let me introduce some exciting new features and improvements developed in the last couple of months.
First one, a with expression, providing a syntax sugar for dealing with resource management. This example allows writing the program from the first blog post like so:
try
let
keys_file = File::open "tests/Keys.txt" {:read}
values_file = File::open "tests/Values.txt" {:read}
keys = File::read_lines keys_file
values = File::read_lines values_file
() = File::close keys_file
() = File::close values_file
in
Seq::zip keys values |> Dict::from_seq
catch
(:ioerror, _, _) -> {}
end |> IO::println
Using the with expression, the same program can be written like this:
try
let
keys = with File::open "tests/Keys.txt" {:read} as keys_file File::read_lines keys_file end
values = with File::open "tests/Values.txt" {:read} as values_file File::read_lines values_file end
in
Seq::zip keys values |> Dict::from_seq
catch
(:ioerror, _, _) -> {}
end |> IO::println
These two programs are equivalent, in terms of their non-blocking and parallel nature, as explained in the previous block. The second example handles file closing, using the with expression, making the code shorter and more concise. In fact, the original expression would not close files properly, if an exception occurred during reading those files! This is fixed in the second program. The with expression is extensible and one can implement their own resource manager.
Another major feature included that landed in Yona is a Software Transactional Memory module (STM). Since Yona does not contain mutable variables, nor does it contain global state, one can use STM module as a mutable dictionary, that can be accessed in a safe manner, not having to worry about the underlying threading implementation. There may be multiple STM systems in Yona application, unlike in Clojure for example.
An example of a program using the STM can be found in the module documentation.
Regular expressions module has been added to Yona as well. The Regexp module allows both matching and replacing strings, similarly to what is available in other languages.
Yona parser is now also available as a Maven artifact. It is used by the initial release of an Idea plugin, which supports syntax highlighting for Yona files. Future development of the plugin should bring more functionality, such as autocomplete, using the library that I forked and improved (performance and API-wise), or some kind of refactoring support etc.
Yona has a brand new REPL, based on JLine3 library. It has a nice readline interface, stores history to a file, has built-in syntax highlighting and tab-based autocompletion. The REPL is started whenever you run. For full list of options, run:
$ yona -h
The homepage has been redesigned and re-structured to make it easier for newcomers to learn about the language philosophy and features. Use the homepage to get started with the language, or get in touch.
I wanted to share some progress update regarding the development of Yona, even before finishing the beta release. There is still plenty of work ahead, especially in the department of standard library and optimisations, but we are slowly getting there.
Please feel free to comment or reach out via any channels available on the homepage, with any feedback, suggestions or questions you might have about the language or any related topic.