3 ms·
I think types are orthogonal to why named parameters are helpful, because parameters don't just indicate a type but a particular usage of a type. So for exampl
by sixbrx 14y ago
I think types are orthogonal to why named parameters are helpful, because parameters don't just indicate a type but a particular usage of a type.
So for example, in a bank transfer method the named parameter would help distinguish the from-account from the to-account. The accounts are already not simple types, but their usages (roles in the sentence underlying the semantics of the method) are different.
You could create a "transfer" class of course for the pair of accounts, but are we going to do this for each combination of usages of our types. Hopefully not - we'd basically be encoding each combination of parameters that our methods accept into an object - not practical or productive in my opinion.