You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here, it's impossible to tell if you're creating the correct kinds of special strings; the special string type is assumed by the compiler.
Consider, instead, an architecture where SpecialString is a protocol that types can conform to, instead of a struct with a marker generic type associated with it:
Here it's clear that we're creating special Username strings. The compiler still assumes some stuff for us so it's not any more or less verbose, but it's obvious to maintainers and peer reviewers what's intended here.
The text was updated successfully, but these errors were encountered:
For example:
Here, it's impossible to tell if you're creating the correct kinds of special strings; the special string type is assumed by the compiler.
Consider, instead, an architecture where
SpecialString
is aprotocol
that types can conform to, instead of astruct
with a marker generic type associated with it:Here it's clear that we're creating special
Username
strings. The compiler still assumes some stuff for us so it's not any more or less verbose, but it's obvious to maintainers and peer reviewers what's intended here.The text was updated successfully, but these errors were encountered: