2023-08-01: Fuzion August Update
Here is this month's update:
Exciting improvements of type inference, visibility of features and interaction with C code:
- Fuzion language
Type inference for arguments from actuals in a call: #1722. In a declaration like
point(x, y i32) is
The argument type
i32can be omitted if there are calls to that feature:
point(x, y) is p1 := point 3 4 p2 := point 5 12
Support for free types #1774 to simplify declarations using type parameters. It is now possible to write
first (s Sequence T) => s.nth 0
first (T type, s Sequence T) => s.nth 0
Free types can be anonymous using
first (s Sequence _) => s.nth 0
one can also use constraints as in
add_to_all (s array N:numeric, v N) => s.map x->x+v say (add_to_all [1, 2, 3] 10)
or complex type expressions like
g(v A | (B : numeric)) => ...
reftypes have been removed: #1705. If a
reftype variant is required, one must now declare a
reffeature and inherit from this.
The type of an outer instance
ais now just
a.this, it used to be
a.this.type: #1706. This is consistent with, e.g.,
nilbeing --depending on context-- either a type or a call resulting in a value.
setkeyword to assign a new value to a field is no longer permitted: #1720.
As an alternative, use the
mutateeffect in your code.
- front end
Fix a bug which caused unjustified errors when chained booleans were used in postconditions: #1685.
The parser and frontend now keep more accurate position information for names, in particular in feature declarations: #1735.
This improves confusing error messages when multiple feature names are given in a declaration. Furthermore, source ranges are now supported such that the entire name is now marked in error messages.
- back end
Add intrinsics to get a network socket's peer's address and port information: #1712.
This is useful when writing server applications using Fuzion, for example to implement IP based access control.
- C back end
If the environment variable
FUZION_DEBUG_TAIL_CALLis set to
fzwill print debug information about tail call optimization: #1687.
In the intrinsics for atomic values, use atomic compare and swap operations when possible, instead of emulating this using a global lock: #1689.
nativefeatures have been implemented, which in the C backend, allow C functions to be called: #1772.
To work with this, the C functions need to be reasonable simple, that is their arguments and return value must be integers, floating point numbers, or Strings. Additionally, Fuzion will not automatically take care of including the right headers and passing the proper arguments to the compiler and linker.
nativefeatures are not supported in the interpreter.
- base library
partially_orderablehave been renamed and moved into the grouping feature
CTriedata structure now uses atomic compare and swap operations, in an attempt at making it actually thread-safe and lock-free: #1598. There are however still remaining issues related to taking snapshots in a multi-threaded environment.
Fuzion now supports IEEE floating point comparisons: #1644. In particular, comparing against
NaNalways results in
false. IEEE semantics for floating point comparison are used for infix operations
type.lteqfor floats define an equality relation and a total order in a mathematical sense. These will be used in type parametric code requiring
orderableand they can be used directly via
equals f64 a bor
lteq f64 a bdefined in the base library.
joinoperation to the
This allows waiting for the end of threads in another thread.
This makes it possible to use multiple different instances of the
tryeffect at the same time.
signmoved from the universe to the
Rename effect handlers in a consistent manner: #1729.
Move some features to the type features of
Use the Ryū algorithm, which is implemented in pure Fuzion, to convert floating point numbers to strings: #1758.
--The Fuzion Team.