Static Binding and Contracts
The following example fails with a precondition failure in the
feature a
when called via the b
feature.
This may seem unintuitive at first.
Since Fuzion does static binding in this case, this is the intended
behavior. To illustrate why this is the case, consider this slightly
changed example, where the feature a
now accepts an argument:
Here, if the call to a
was using dynamic binding, then
precondition checks would produce inconsistent results when checking the
argument, depending on what type was given. This is what needs to be
avoided.
last changed: 2025-02-13