Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Is it really more "programmer friendly" to create wrapper types for individual strings all over your codebase that need to have passthrough methods for all the common string methods?

That can be handled transparently in languages that have good support for strong type systems, like Rust or Haskell, using traits or type classes.

What you're saying is essentially that addressing stringly typing can only be taken so far in weakly typed languages, without becoming inconvenient.

> Meanwhile the real world usages of this term I've seen in the past have all been things like enums as strings, lists as strings, numbers as strings, etc... Not arbitrary textual inputs from the user.

The definitional question is not that interesting. The point is that the concept applies just as much to a username represented as a string as it does to any other kind of value being represented as a string.

The reason is simple, which is just that "string" is a general type that can represent anything, whereas "username" is a subset of all possible strings. If you're trying to use your type system to ensure correct code, you want to be able to type check a function signature like `f(user, company, motto)`, just to take a simple example.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: