Understanding Generic Functions

P T Withington ptw at pobox.com
Thu Nov 15 05:02:21 PST 2007


On 2007-11-15, at 02:52 EST, Lars Hansen wrote:

[...]

> Generic functions can be useful for adding type-dispatched  
> functionality
> after the fact without creating facades/wrappers.

My view is that generic functions recognize that any function with  
more than one class parameter can't logically belong to any particular  
class.  They allow behaviors between classes to be described  
logically, rather than being artificially attached to one of the  
classes of their parameters.

Hey, can I say something like:

generic function get a (this: Foo) ?

[...]

> IMO we have a couple of options:
>  * remove generic functions from ES4 because they are too limited.
> Operator overloading goes away, too.
>  * accept them as they are, recognizing that they are future-proof and
> that they can be extended in later editions of the language (as we've
> done for type parameterization)
>  * try to extend them with insta

Is my mail client broken, or did you hit send too soon?



More information about the Es4-discuss mailing list