[PEAK] Regular functions vs generic functions

Aaron Lebo aaron.m.lebo at gmail.com
Thu Feb 14 23:14:52 EST 2008


There's a pretty major and obvious distinction between regular functions and
generic functions in any language that supports them. Functions are
relatively simple and easy to use, but functions are also somewhat limited.
If I define a function named print, and I want it to support a new bit of
data, I have to edit the source of the function itself. If I have a generic
function print, adding new functionality is simple and seamless. I don't
actually have to change existing code. That's the point of generic functions
of course. :)

Anyway, I'm wondering more about this distinction and it seems that any time
you use a regular function, you've already set limitations on yourself. They
simply aren't as extensible. I am interested if you could get by using only
generic functions, or if you'd run into performance issues or other
limitations that you wouldn't have in using both regular and generic
functions (PEAK-Rules)?

Is it feasible (or even something you'd want to do) to only use generic
functions? I also noticed this line in the readme, which seemed related to
my current question. "These decorators also all work with
*existing*functions; you do not have to predeclare a function generic
in order to use
it." What does that mean in practice?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.eby-sarna.com/pipermail/peak/attachments/20080214/fa2166cd/attachment.html


More information about the PEAK mailing list