I really hope rust gains this feature aswell. It would be good to experimentally implement alongside function argument defaults, I looked at doing latter but didn’t get so far, but I saw there’d be a common pattern between the two.
How far could either of these go,
could the defaults be expressions rather than just values, with some restriction on dependancy (e.g. each expression can only depend on earlier values).
I wonder if the core team would be open to parsing them into the AST but not actually use them (spit out an error message when found), just to make experiments on this feature easier. (without peoples experimental forks diverging too far).