Re:Limitations of protocols in Swift
by captaincrowbar on Wednesday December 16, 2015 @08:19AM
(#10744039)
To me this looks like exactly the sort of situation where classical OO inheritance is the right answer. All of those things are kinds of Account and should have a common base class.
[ Parent
| on HN ]
Re:Limitations of protocols in Swift
by Manishearth on Wednesday December 16, 2015 @10:12AM
(#10744689)
Classical OO inheritance is the right answer in a language that supports it, though. There may be equally ergonomic ways of doing it in languages with ADTs.
(Which may or may not be the case here, depending on extensibility)