|
|
|
|
|
by actsasbuffoon
3800 days ago
|
|
There 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. |
|