Types to distinguish parameters and dimensions
Suppose a language had a rule that said a function could only have one parameter of a given type, and each dimension of a multidimensional array had to be indexed by a different type.
This would have several benefits:
- You'd get extra fine-grained checking; you couldn't possibly get parameters mixed up
- When making array slices or currying, you wouldn't have to concern yourself with the ordering of the parameters.
- You wouldn't need to distinguish between optional named parameters and ordinal parameters. The name of a parameter would be (or would be derived from) it's type.
No comments:
Post a Comment