converts the specified value to another type
Example
<Int> x := coerce("0xff");
The target type is determined through type deduction where possible. Alternatively, the explicit form:
Example
print("\nYou entered: " + (Number)coerce(input("Enter a number: ")));
Notably, coerce is useful for dynamic type behavior when a value respects an external interface that it did not explicitly implement.
Example
Human := type { <void -> void> speak <- () { print("Hello, world!\n"); }; }; TalkingActionFigure := type { <void -> void> speak := () { print("Stay in school.\n"); }; }; <TalkingActionFigure> amazotron; <Human> canSpeak <- coerce(amazotron); canSpeak.speak();