4 ms·
Why would you alias your functions? I don't write in clojure, but I haven't encountered it in java/javascript/c++/Matlab
by shacharz 12y ago
Why would you alias your functions? I don't write in clojure, but I haven't encountered it in java/javascript/c++/Matlab
- phillord 12y agoThe aliasing is just an example. The real use case involved pulling functions out of a map. The main use of "aliasing" is to alias a namespace (to save typing) or to rename a function from one namespace where it clashes with one in local.
- mackwic 12y agoBecause of clarity ? A function can have a really broad use, and the particular use case is unclear when you call it. In this hypothetical but likely situation, aliasing the general function to a more-specific name is good neighbor behavior, isn't it ? Note that it's particularly frequent when you are used to code with lot of purity and high-order applications, when you define few pure functions with lot of parameters and specialize them in your modules by fixing some of the parameters. Sometimes you don't want to (or can't) fix a parameter but still want the function to have the specialized name.