2023-04-04: Fuzion April Update
Hi,
Here is this month's update:
- Fuzion language
-
Introduced syntax sugar for lazy evaluation. The
Lazyfeature 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
oiso.this.type, which is a placeholder foroor any heir ofo. Withino, an inner featurefiwith a inner result typetiwill have the effective resulting typeo.this.type.ti, which becomeo.tiwhen the other instance iso. However, for a heirpthat inherits fromo, the result type of a callp.fiautomatically 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 liketiare 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
ifstatement following anelse(in an if or loop statement) (#1297).
-
- base library
-
New features
Mutable_Linked_Listandmutable_tree_mapwhich implement a linked list and AVL trees using themutateeffect (#1148, #1177). -
The
has_equalityfeature has been renamed asequatable. Features prefixed withhas_will in the future designate predicate features. The nameequatableis inspired by Swift (#1199). -
With built-in support for
Lazyarguments, features such aslist_of_none_lazyandoption.lazyGethave been removed in favor f making the main versions of theses features lazy by default (#1240, #1241). -
A
Unaryfunction type has been introduced. This allows easy function composition. Lambdas which take exactly one argument will now be detected by Fuzion as functions of typeUnaryby default (#1224). -
Internal changes have been made in preparation of making
arraysliceable (#1178). -
Monoidnow 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.