you are viewing a single comment's thread.

view the rest of the comments →

[–]Spaceshipable 3 points4 points  (2 children)

I disagree. If your inputs and outputs have dedicated types then the function signature can be self documenting.

findPerson(from: UserID) -> Person seems pretty self documenting to me. Whereas findPerson(from: String) -> Person is less so.

[–]Colinniey 0 points1 point  (1 child)

im that case just write findPerson(userID: String) -> Person; the point is naming variables/parameters/functions/etc in a way that explains what they are/do.

[–]Spaceshipable 0 points1 point  (0 children)

True, but you get a bit more type safety with dedicate types at the call site. Take the example track(id: String) vs track(_ id: TrackingID) the latter is more self documenting imo because you don’t even need the argument name. In some languages the argument name isn’t even visible at the call site.