@kate @schuelermine Languages with static analysis inference engines need a way to decide when to stop inferring and require the user be explicit about something, which serves as a kind of a "circuit breaker" in the whole system---it's a place where the inference engine can stop and bundle up a chunk of program and declare deterministically "this chunk has these properties all the time." Rust does what a lot of languages do and makes functions one of those places (I'm hand waving and ignoring generics a bit here).

You can contrast that with C++, which, due to the interplay of the preprocessor letting you redefine anything, a lack of actual module system meaning anything you include and anything your includes include can influence the code you're writing, the template engine trying to match against all possible specializations of a template, and the separation of compiler and linker steps, has the delightful property that when you look at a function call, you really know very little about how that function is defined. Maybe `int` means something different in this section of code. Maybe there are two different implementations of the function depending on which translation units were fed to the linker. Maybe there's a template specialization hiding out somewhere way up in the include files that are included by the include files you include that special case is one possible pattern match of the types of arguments in a template.

This nonsense not only makes the code hard to compile, it really makes it hard to reason about.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.