-
Notifications
You must be signed in to change notification settings - Fork 27
Function Overloading
Function overloading doesn't make much sense (when it comes to varying parameters) as you can't dynamically call functions with a varying number of parameters
However has use when trying to pass through variable amount of keyword parameters in macros. We are talking about &key &allow-other-keys here
Useful thread
https://groups.google.com/g/comp.lang.lisp/c/rvE7Yd3GEwo/m/9c3e1ivMBuwJ
Note that it becomes NLP like then, and documentation becomes hard
No native concept of function overloading in CL
CLOS is different - polymorphism & dynamic dispatch vs. ...
Don't worry about naming, since you can have multiple packages and shadow each other that way
https://groups.google.com/g/comp.lang.lisp/c/LTxR2mAEu-g
KMP:
It IS intended that you sometimes define additional methods on generic functions.
It is NOT intended that you do overloading.
Overloading is the practice of applying unrelated definitions to the same operator.
The idea behind generic functions is that you first define the "meaning" of the generic operation in terms of the signature its arguments will take. Then you define methods that implement this signature for a variety of types that all satisfy the meaning of the generic function.