2023-04-04: Fuzion April Update
Hi,
Here is this month's update:
- Fuzion language
-
Introduced syntax sugar for lazy evaluation. The
Lazy
feature approach from the design page has been selected for this (#1197).As an example, the
infix :
operator now takes a lazy argument and can be used to create a lazy list of integers as follows:ints(i i32) => i : ints i+1 # head i, tail lazy recursion starting at i+1 say ((ints 1).take 10) # will print `[1,2,3,4,5,6,7,8,9,10]`
-
The code for handling of outer types has been rewritten entirely to fix various bugs (#229 and #1180). Essentially, a type of an outer feature
o
iso.this.type
, which is a placeholder foro
or any heir ofo
. Withino
, an inner featurefi
with a inner result typeti
will have the effective resulting typeo.this.type.ti
, which becomeo.ti
when the other instance iso
. However, for a heirp
that inherits fromo
, the result type of a callp.fi
automatically becomesp.ti
:o is ti is fi ti is # result type is o.this.type.ti ti p : o is say (type_of o.fi) # will print `o.ti` say (type_of p.fi) # will print `p.ti`
This requires a bit of care since within
o
, types liketi
are incompatible too.ti
. -
The parser has been improved to avoid a bug where an
infix :
was erroneously detected as the syntax for inheritance (#1226). -
Multi-line strings are now supported, they are documented in the
tutorial for string
constants (#1267).
s := """ <!DOCTYPE html> <html> <head> <title>Fuzion</title> </head> <body> <p>A multi-line string constant!</p> </body> </html>"""
-
A parser bug was fixed that made it possible to have an
indented
if
statement following anelse
(in an if or loop statement) (#1297).
-
- base library
-
New features
Mutable_Linked_List
andmutable_tree_map
which implement a linked list and AVL trees using themutate
effect (#1148, #1177). -
The
has_equality
feature has been renamed asequatable
. Features prefixed withhas_
will in the future designate predicate features. The nameequatable
is inspired by Swift (#1199). -
With built-in support for
Lazy
arguments, features such aslist_of_none_lazy
andoption.lazyGet
have been removed in favor f making the main versions of theses features lazy by default (#1240, #1241). -
A
Unary
function type has been introduced. This allows easy function composition. Lambdas which take exactly one argument will now be detected by Fuzion as functions of typeUnary
by default (#1224). -
Internal changes have been made in preparation of making
array
sliceable (#1178). -
Monoid
now uses the type's underlying equality relation rather than depending on one specified by theMonoid.infix ==
feature. - the work on networking support is still ongoing (#1223).
-
New features
- fz tool
- Compilation time was quadratic in the code size of one feature. In particular, inline arrays could easily trigger very long compilation time. This has been reduced to linear time for most cases (#1291).
- The formatting of code in error messages and other fz output has been adjusted to improve readability (#1191).
- If a feature is called with the wrong number of arguments, a solution will be proposed now (#1195).
Cheers,
--The Fuzion Team.