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
-
In preparation of enforcing visibility, many things relating to visibility have been improved or changed: #1690, #1691, #1695, #1714, #1731, #1734, #1736, #1744.
-
Type inference for arguments from actuals in a call: #1722. In a declaration like
point(x, y i32) isThe 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 0instead of
first (T type, s Sequence T) => s.nth 0Free types can be anonymous using
_:first (s Sequence _) => s.nth 0one 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)) => ... -
Explicit
reftypes have been removed: #1705. If areftype variant is required, one must now declare areffeature and inherit from this. -
The type of an outer instance
ais now justa.this, it used to bea.this.type: #1706. This is consistent with, e.g.,nilbeing --depending on context-- either a type or a call resulting in a value. -
The
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 totrue,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.
-
C FFI:
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
-
The features
equatable,orderable,partially_orderablehave been renamed and moved into the grouping featureproperty: #1466. -
The
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 infalse. IEEE semantics for floating point comparison are used for infix operations=or<=, etc.In contrast,
type.equalityandtype.lteqfor floats define an equality relation and a total order in a mathematical sense. These will be used in type parametric code requiringequatableororderableand they can be used directly viaequals f64 a borlteq f64 a bdefined in the base library. -
Add a
joinoperation to theconcur.threadseffect: #1651.This allows waiting for the end of threads in another thread.
-
Parameterize the
tryeffect #1696.This makes it possible to use multiple different instances of the
tryeffect at the same time. -
plus,minus,signmoved from the universe to thenumhierarchy: #1702. -
wrapping_integeris nownum.wrap_around: #1719. -
Rename effect handlers in a consistent manner: #1729.
-
Move some features to the type features of
ps_map: #1756. -
Use the Ryū algorithm, which is implemented in pure Fuzion, to convert floating point numbers to strings: #1758.
-
Fix issues which caused the
fuzion.sys.misc.unique_idintrinsic (used by themutateeffect) andsayto not be thread-safe: #1762, #1764.
-
Cheers,
--The Fuzion Team.