-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
For example:
someFunction(specificSpecialStrings: someRawStrings.map(SpecialString.init))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:
someFunction(specificSpecialStrings: someRawStrings.map(Username.init))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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request