4 ms·
That has nothing to do with types vs. variables. Try having a variable signon and a variable signOn. Or two functions with the same type signature, one called
by rbehrends 11y ago
That has nothing to do with types vs. variables.
Try having a variable signon and a variable signOn. Or two functions with the same type signature, one called signon() and one signOn() (for example, imported from two different modules).
- kibwen 11y agoBy default, the Rust compiler warns you when you use uppercase characters in variable and function identifiers. The community overwhelmingly adheres to this style. Rust is also extremely strongly-typed, so not only would you have to be willfully disabling the style warnings, you would have to have to manage to give them the same types, and furthermore given the nature of Rust code it's rather possible that you'll still get a compilation error due to using a variable in a way that it didn't expect. You also can't "accidentally" introduce new variables in Rust, as you can in Python via typos.
- rbehrends 11y agoYes, enforcing case strictly via style guidelines that prevent mixing of upper- and lowercase is another way of avoiding that problem (underscores can still trip you up in a similar fashion, of course, e.g. signon vs. sign_on). I'm still not sure how the discussion got sidetracked into discussing Rust, though.
- Dewie3 11y ago> I'm still not sure how the discussion got sidetracked into discussing Rust, though. Yes, let's generalize - reading the blog and the comments, this "case sensitivity ruins productivity"-problem seems to only be a problem in scripting languages.
- iopq 11y agoYou'd have to declare both of them in the current module. That's why I don't do glob imports. I would see use foo::signon; use bar::signOn; clearly, if I have to import this in my own file I should be VERY careful about those two functions or rather, I'd import from foo, but I'd use the namespaced version from bar so `signon` would be `foo::signon`, but `bar::signOn` would be written out fully to avoid this kind of clash
- rbehrends 11y agoI'm really not sure what the point of referencing Rust is. This was about programming languages in general, and the post I was referring to was about C#. Also, importing is an example, another example would be accidentally declaring a second variable in the same module (should not happen, but people make errors), or a number of other situations where two identifiers that are identical except for case end up in the same scope.
- iopq 11y agoI'm referencing Rust because I'm working on a Rust project right now. I don't even know C#. Here's how you declare a binding: let signOn; let signon; I seriously hope you don't declare both of these in the same scope