[pro] style question about types, coercion, expectations for function parameters

Pascal J. Bourguignon pjb at informatimago.com
Thu May 31 19:22:01 UTC 2012


Ryan Davis <ryan at acceleration.net> writes:

> The answer we arrived at was "yes":
>
>     (defun send-email (to from subject body)
>       (let ((to (etypecase to
>                   (string to)
>                   ((integer 0) (email (fetch-client to)))
>                   (client (email to))
>                   )))
>         ;; ... more code
>         ))
>
> The "to" parameter can be anythings that can be mapped to an email
> address. 

Yes, it's what's usually called a "designator", specifically, an email
designator.  CL itself defines and uses a few designator types (string
designators, package designators, pathname designators, list
designators, etc).

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.




More information about the pro mailing list