Compiler choosing between functions with no parameters vs functions with default parameters

That's correct. The general principle is that the most specific overload should win, and a function that always takes 0 parameters is "more specific" than a function that sometimes takes 0 parameters.

We (compiler contributors) should really write down some concrete instances of this rule, and ideally would have the entire ranking system documented; it isn't right now because (I hate to say) there's a bunch of emergent complexity there that the people who work on the expression type checker want to simplify before recording it properly.

9 Likes