2024-04-11: Fuzion April Update
Last month brought massive improvements in the internal plumbing of the Fuzion
implementation. Important improvements include automatic unwrapping for, eg.,
mutable or atomic values, removal of the stateful base library
feature Stream in favor of stateless list, increased
accuracy of data flow analysis for effects, and Java interface support for the C
backend.
- General
-
Fuzion's algebraic effects and static analysis will be presented at the AEiC 2024 — Ada Europe International Conference on Reliable Software Technologies in Barcelona on 11-14 June 2024.
-
- Documentation
- Build infrastructure
- Fuzion language
-
Support for automatic unwrapping of values (#2644). This enables using values of types like
mutate.neworatomicdirectly without explicit unwrapping usingv.get. -
Functions and constructors declared using
{ }now also require theiskeyword or an arrow=>(#2655, #2657, #2658, #2774). -
Allow
thento be placed at minimum indentation (#2656). This permits code as follows:if a=b then say "equal" else say "not equal"
-
- base library
-
A new feature
auto_unwrapcan be used to enable automatic unwrapping for arbitrary features (#2644). -
Added features
array2.transposeandarray2.type.create2(#2663). -
Renamed
id(T)asidentity(T)(#2705). This enables partial application forid(T,x)to do things likel.filter idon aSequence bool, which was not possible before since the reference toidwas ambiguous. -
Added precondition for
array.slice(#2736). -
Increased buffer size in
file.readto 4K (#2737). -
Removed feature
Streamsince it require mutable state (#2769). Instead,listshould be used to iterate aSequence. -
Minor implementation improvements (#2739, #2757, #2772, #2776, #2784, #2793, #2818, #2819).
-
- Front End
-
Better error messages for features defined in modules (#2654, #2670)
-
Replace streams by lists when a loop index variable iterates over a Sequence (#2758)
-
Front end always creates a module file and passes this to the later phases instead of the AST (#2817).
-
Minor implementation improvements (#2447, #2610, #2651, #2659, #2660, #2666, #2669, #2672, #2674, #2688, #2729, #2730, #2734, #2735, #2767, #2777, #2779, #2787, #2789, #2821)
-
- Fuzion Intermediate Representation
-
Improved quality of dumped intermediate code (#2692, #2706).
Here is an example output:
> ./build/bin/fz -XdumpFUIR -e "for a := 1, a+1 while a < 10 else say a" | tail -n 30 Code for #loop0(outer universe#0, a i32) unit l3: 0: Current 1: Call #loop0.a(outer #loop0) i32 2: Const of type i32 00 00 00 04 0a 00 00 00 3: Call infix < i32(outer universe#0, a i32, b i32) bool 4: Match 0=>l1 1=>l2 l1: 0: Current 1: Call #loop0.a(outer #loop0) i32 2: Const of type i32 00 00 00 04 01 00 00 00 3: Call i32.infix +(outer i32, other i32) i32 4: Current 5: Assign to #loop0.a 6: Current 7: Call #loop0.a(outer #loop0) i32 8: Call #loop0(outer universe#0, a i32) unit 9: Current 10: Assign to #loop0.#exprResult0 goto l3_4 l2: 0: Current 1: Call #loop0.a(outer #loop0) i32 2: Box i32 => ref i32 3: Call say(outer universe#0, s Any) unit 4: Current 5: Assign to #loop0.#exprResult0 goto l3_4 l3_4: 7: Current 8: Call #loop0.#exprResult0(outer #loop0) unit 9: Current 10: Assign to #loop0.#result -
Added support for a
site , i.e., a code position in a class (#2752). -
Minor implementation improvements (#2447, #2610, #2651, #2659, #2660, #2666, #2669, #2672, #2674, #2688, #2723, #2815, #2820)
-
- Data Flow Analysis
-
Tailcall handling improved for JVM backend (#2697).
-
Fixed handling of unreachable code following
voidresult that caused errors in backends (#2698). -
Improved error produced in case of missing effect installation before effect use (#2732).
-
Increased analysis accuracy by distinguishing calls by their call site (#2753, #2755) and by comparing effect values (#2763).
-
Improved error produced for uninitialized fields (#2754).
-
Code cleanup (#2696, #2707, #2710, #2713, #2718, #2764) and fixes (#2750, #2766, #2810).
-
- Effect backend
-
Use data flow analysis instead of control flow analysis for
-effectsanalysis (#2720).
-
- JVM back end
-
Support for exceptions in Java interface (#2667).
-
For
-jarbackend: Add missing classes needed to handle errors such asStackOverfowError(#2716). -
Removed dependency on interpreter backend (#2686).
-
Disable tail recursion optimization within precondition (#2693).
-
Fixed epilog code gen for special cases (#2747).
-
Fixed
matchwith case fields in the universe (#2762). -
Add source file and line number attributes to created byte code (#2801, #2802).
-
Increased robustness of intrinsics in case of an thrown Java Error (#2804).
-
- C back end
- interpreter back end
- util
- FZ tool
-
Minor implementation improvements (#2671)
-
- Tests
- Overall Code
Cheers,
--The Fuzion Team.