auto_cast: A primitive for formal type deduction in a formal language

Author: Amlal El Mahrouss

Published November 8, 2026

The Concept:

Take a variable x mark it as castable to Y to the AST. The AST shall then be able via a graph of castable types be able to cast x to Y.

Example in C++:

auto x = __castable<Y> X();
auto ref_xy = x->as<Y>();

Probable Applications

It may be quite vague for some, but bear with me: Could be useful in use cases where x matters in how is treated.