3 ms·
In some languages, however, data constructors live in a separate namespace from variables and in some they do not. In ML and Rust, mistyping a a data construct
by Blikkentrekker 6y ago
In some languages, however, data constructors live in a separate namespace from variables and in some they do not.
In ML and Rust, mistyping a a data constructor's name produces a variable, and thus matches everything, whereas OCaml and Haskell require that constructors start with an uppercase name, and disallows variables to do so, so this cannot easily occur.
But, since in Rust data constructors are typically qualified with a namespace except for some frequently used ones, this is not a problem in practice.
- steveklabnik 6y agoIt’ll also often produce one or more warnings in Rust, which can help.
- Blikkentrekker 6y agoIndeed. — that Rust warns against unused variables and has language facilities to suppress such warnings if ever they be so intended has no doubt caught many typos that other languages have not.