This release features the first version of the explicit state proposal. With the following changes
- Rust, ML and S-Expression frontend support of the
function with state
syntax which associatesfunction
with the state formed by the expressionstate
. Functions bound thus are stateful functions and are treated differently. Functions not bound to a state are stateless functions. - The JSON representation has changed to also include state arcs.
For the time being state is restricted to environment values or values bound in
the top level scope (i.e. not in an if
, smap
etc context).
- Functions with no return expression (i.e. last expression is terminated with
;
) are now supported and implicitly return()
ohua-dev/alang-clike-parser#4 - Syntax for lambdas has been tweaked to more closely resemble actual rust
syntax with the form
| arg1, ... args | expr
or| arg1, ... args | { stmts }
ohua-dev/alang-clike-parser#10 - Import syntax now also supports actual rust style with the forms
name::space::import_item
orname::space::{import_item, ...items}
ohua-dev/alang-clike-parser#6 - Variable names beginning with
_
are no longer rejected by the parser. This also enables the use of_
as an identifier for ignored values ohua-dev/alang-clike-parser#5 - Literals
()
(empty parentheses) is accepted as a literal for the unit value- Numeric literals are supported i.e.
1
,2
,-100
- Introduced the
with
keyword (operator) that binds a state to a function.
- Literals
()
(empty parentheses) is accepted as a literal for the unit value- Numeric literals are supported i.e.
1
,2
,-100
- Introduced the
with
keyword (operator) that binds a state to a function.
- Literals
nil
is supported as a literal for the unit value- Numeric literals are supported i.e.
1
,0
,-1000
(due to the liberal rules for the names of clojure identifiers the-
must not be followed by a space for it to be parsed as a literal)
- Imports now use
(require type [imports])
syntax wheretype
is one ofsf
oralgo
- Introduced the
with
special form that binds state to a function.
ALang as well as the .ohuaml
, .ohuac
and .ohuas
formats now support
numeric literals and a unit literal.
ohua-dev/ohua-core#23
In general the literals for ()
are supported both as expressions as well as in
patterns. Integer literals are currently not supported in patterns.
Caveat: The backend implementation does not necessarily properly support these literals. (Specifically the generated java code most likely breaks when using literals.)
A new, rich frontend intermediate language has been introduced ohua-dev/ohua-core#23. This enabled the following features:
- Features of the individual parsers are now more similar, as they do not need to be desugared in the parser itself but are handled uniformly by the compiler.
- Destructuring/pattern matching is now a desugaring feature and supports arbitrarily nested patterns. ohua-dev/ohua-core#17
- The JSON representation changed to incorporate state arcs and compound arcs.
As a result the
"arcs"
key in the JSON now contains an object with the keys"direct"
for direct (or classic) arcs,"compound"
for arcs where multiple, local sources are combined into a single argument and"state"
which lists arcs to be set as the state of a function.