2023-12-04: Fuzion December Update
Last month was the time for some major front-end and language improvements, in particular support for partial application adds a lot of development fun!
Here is what happened in detail:
- Fuzion language
-
Added support for partial application (#2265). In particular, the following partial calls are supported now:
partial expression expands to explanation f x y
a,b,c -> f x y a b c
partial call turned into a lambda
f x y
() -> f x y
a call may be turned into a nullary function
++ x
a -> a ++ x
A prefix or postfix operator may be turned into an infix operator
x ++
a -> x ++ a
dto.
-
a -> -a
ora -> a-
ora,b -> a-b
A single operator may become a prefix, postfix, or infix operator in a lambda
.as_string
a -> a.as_string
A dot followed by a call is a call in a lambda that receives its target as an argument
-1
a -> a - 1
a numeric literal with a sign may become an infix operator
Note that a single operator given as an argument to a call will be parsed as a postfix or infix operator, so it usually will have to be enclosed in parentheses as in
(-)
The same holds for partial application of the target of a call using
.
as in(.as_string)
-
When redefining an inherited feature, it is now enforced that the visibility is not restricted (#2233).
-
- base library
-
memoize
is now public (#2248). -
New feature
Sequence.scan
to create lists of results of folding all prefixes of a list (#2197). e.g.,
results in[1,2,3,4,5].scan i32.type.sum
[1,3,6,10,15]
-
marray
has been replaced bymutate.array
(#1930). -
A new module lock_free.fum was added with a lock-free stack implementation as a first entry (#1917).
-
- Front end
-
A contract whose result type is not
bool
now results in an error (#2268). -
Type inference from anonymous feature now results in the base type if that is a
ref
type, which is typically the desired type (#2254). -
Added concept of effective visibility which is the combination of the outer feature's visibility and its own visibility. Visibility checks now use effective visibility when verifying argument and result type visibility. (#2246).
-
Fixed feature lookup for features added in modules (#2245).
-
- Middle end
-
Fixed crashes when empty block is used to return a
unit
type result that is a tagged element in achoice
(#2267). -
Fixed inheritance of types for the case of a type parameter that is replaced by an actual type twice: via the inheritance change and in an outer feature (#2243).
-
Support for calls as compile-time constants (#2067).
-
- JVM back end
-
JVM backend runtime now has its own version of
OpenResource.java
for resource handling (#2256). -
Reduced code size by joining precondition and routine body into one Java method (#2196).
-
Internal improvements: Added null type (#2089).
-
Code is no longer run in the main thread, but all code is run in an instance of
FuzionThread
(#2177).
-
- C back end
-
Fixed an old and tough bug where a value result from a dynamically bound call could result in a dangling reference on the C stack (#2260).
-
Now uses C's compound literals to create Fuzion's String constants (#2225).
-
-
There is a Fuzion repository with Fuzion solutions to this year's Advent of Code!
Cheers,
--The Fuzion Team.