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
ofkeyword (#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
iskeyword 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 indentationor
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 indentationforbid 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 ()->4711one can now write
log_string(s ()->String) => if logging then say s() log_i32(s ()->i32) => log_string "i32:{i()}" log "test" log 4711improve type inference for calls to
flat_map,bindwhere 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
fixedimplementation alongsideabstractfeature 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
Sequenceoftuples, 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
tuplessay <| [(".0",(".1.0", ".1.1"))].map (.1.0) say <| [(".0", ((".1.0.0", ".1.0.1"), ".1.1"))].map (.1.0.1)or
tuplesof 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)
fzcommandfz: option
-saveLibof thefzcommand 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-Dto allow interactive input terminated with thereturnkey(#4894)
-
- Documentation
- Parser
- Front End
resolveSyntacticSugar2, performance enhancements (#4921)
- bug fixes
Match.typeForInferencingreturnnullon 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.