2025-04-11: Fuzion April Update
Last month, the focus has shifted towards a number of minor Fuzion language improvements, cleaning up syntax sugar that was rarely used, disallowing confusing syntax and improving type inference.
Furthermore, important progress is happening on the native interface.
- General
We are happy to welcome Nina Hinkkanen from Finland for an internship until May at Tokiwa Software GmbH!
- Fuzion language
remove
of
keyword (#4983). The syntax sugar of the formfruit : choice of apple, pear, banana.
now has to be written as
apple is pear is banana is fruit : choice apple pear banana is
-
remove full stop (#4979). Empty feature declarations like
point2D (x, y i32). point3D (x, y, z i32).
now have to be written using
is
, even if nothing follows:point2D (x, y i32) is point3D (x, y, z i32) is
require
is
keyword for anonymous feature declaration (#4956), i.e., instead ofnul String => ref : String public redef utf8 Sequence u8 => [u8 0]
the new syntax is:
nul String => ref : String is public redef utf8 Sequence u8 => [u8 0]
-
the code of an anonymous feature now must be indented further than
ref
(#4976). So instead ofnul String := ref : String is public redef utf8 Sequence u8 => [u8 0]
we now require
nul String := ref : String is public redef utf8 Sequence u8 => [u8 0]
or
nul String := ref : String is public redef utf8 Sequence u8 => [u8 0]
Restrict possibilities for indentation of
else
(#4948), disallowing confusing cases such asif c0 then "-true-" else if c1 then "-false::true-" else "-false::false-" # 1. should flag an error: inconsistent indentation
or
if c0 then "-true-" else if c1 then "-false::true-" else if c2 "-false::false::true-" else "-false::false::false-" # 2. should flag an error: inconsistent indentation
forbid setting argument visibility on non constructor features (#4904)
Enable partial application for string literals, numeric literals and operator calls (#4867). This avoids the explicit use of lambda: instead of
log_string(s ()->String) => if logging then say s() log_i32(s ()->i32) => log_string ()->"i32:{i()}" log ()->"test" log ()->4711
one can now write
log_string(s ()->String) => if logging then say s() log_i32(s ()->i32) => log_string "i32:{i()}" log "test" log 4711
improve type inference for calls to
flat_map
,bind
where the type parameter must be inferred from the type parameter of a lambda result (#4916). This simplifies code likesay ([1,2,3].flat_map i32 x->[x,x])
to
say ([1,2,3].flat_map x->[x,x])
allow
fixed
implementation alongsideabstract
feature declaration(#4934)redefined features no longer inherit visibility of original feature (#4915)
partial application now works for select (#4936). This is very useful for accessing elements in a tuple, e.g., as follows:
The following code sums up the first elements of a
Sequence
oftuple
s, resulting in8
:say ([(3,4),(5,6)].map (.0) |> .sum)
while this sums up the second elements of a Sequence of tuples, resulting in
10
:say ([(3,4),(5,6)].map (.1) |> .sum)
This can also be used for nested
tuple
ssay <| [(".0",(".1.0", ".1.1"))].map (.1.0) say <| [(".0", ((".1.0.0", ".1.0.1"), ".1.1"))].map (.1.0.1)
or
tuples
of arrayssay <| [(0,[1,2,3],0), (1, [4,5,6], 1)].map (.1[2])
or with subsequent calls
say <| [("a","b","c"), ("d","e","f")].map (.2.as_string)
fz
commandfz: option
-saveLib
of thefz
command is now called-save-module
(#4888)
- Base library
-
New base library features
-
Changes to the following standard library features
When reading form
io.stdin
, no longer block untilEOF
/ctrl-D
to allow interactive input terminated with thereturn
key(#4894)
-
- Documentation
- Parser
- Front End
resolveSyntacticSugar2, performance enhancements (#4921)
- bug fixes
Match.typeForInferencing
returnnull
on error (#4919)fix NPE in
Select.toString
(#4958)fix NullPointerException for target of Select (#4960)
suppress subsequent errors in case of type inference of lambda error (#4931)
add check for argument and result types of native features (#4850)
allow setting feature name for features with arguments (#4969)
do not implicitly assume result type to be void (#4974)
fix class cast exception (#4968)
fix issue with type inference of inheritance call of cotypes (#4891)
fix logic in
isExtensionFeature
(#4889)fix type parameter inference for inheritance call (#4890)
- Middle End
- Back Ends
native: add upcalls, i.e., passing Fuzion function for callback to native code (#4926)
- Build
- Tests
- Windows
fix error: 'poll.h' file not found (#4977)
Cheers,
--The Fuzion Team.