Christopher Barber wrote:

It is possible to mimic the behavior of overloading by defining a macro which examines its arguments and determines which implementation to dispatch to, but it is usually not worth the trouble.



Also, Curl's support for optional, rest, and keyword arguments in procedure (as well as method and constructor) argument lists means that many problems that would otherwise be solved using overloading are easy to solve without overloading. For example, if you want to define a procedure that sometimes takes one argument and sometimes two, it is easy to define a procedure using a definition like this

   {define-proc {p a:double, ...:double}:double
        <procedure body>
   }

and then within the body of the procedure you can check whether or not a second argument was supplied, and act accordingly.

-Bert

Reply via email to