Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

dynamic_apply

Any.dynamic_apply

(R 
type
, F 
type
: Typed_Function R, f F)
 => 
R
dynamic_apply -- apply `f.call` to `Any.this`'s dynamic type and value

This can be used to perform operation on values depending on their dynamic
type.

Here is an example that takes a `Sequence Any` that may contain boxed values
of types `i32` and `f64`. We can now write a feature `get_f64` that extracts
these values converted to `f64` and build a function `sum` that sums them up
as follows:


NYI: IMPROVEMENT: #5892: If this is fixed, we could write

Type Parameters

0.095dev (2025-09-09 14:29:31 GIT hash 98644f8f651c2101a0730cfe31c5807993b7603b built by fridi@fzen)