3 ms·
In some sense, taking several parameters of the same type can be a code smell. Foo(str, str, str) strikes me as somewhat suspect. I realize this isn't always a
by echelon 11y ago
In some sense, taking several parameters of the same type can be a code smell.
Foo(str, str, str) strikes me as somewhat suspect. I realize this isn't always avoidable, but a lot of the time it is.
- actsasbuffoon 11y agoThere are workarounds for this kind of thing. Haskell uses newtypes to wrap a value with a semantically meaningful tag. Scala has a similar concept called "value types." That means you could turn something like this: loginUser(String, String) Into this: loginUser(Username, Password) These aren't just type aliases. So far as the language is concerned, Username and Password are incompatible types.