[plt-scheme] Swindle: defgeneric arity
The dotnet API to Common Larceny is based on Swindle and it needs to
support methods of varying arity. I added an <arity-overload> metaclass
that dispatches on arity first, then the normal dispatch second.
Generic functions
are transformed to arity-overload functions when necessary.
Look in lib/mzscheme/dotnet.sch file in the Common Larceny release.
On 5/26/06, Eli Barzilay <eli at barzilay.org> wrote:
> On May 25, Doug Orleans wrote:
> > I'm just getting my feet wet with Swindle, and noticed that you
> > can't have two methods with different arity on the same generic. Is
> > there a deep implementation (or design) reason for this, or is this
> > just something left over from the CLOS tradition?
> >
> > (I realize I can probably use the MOP to make multiple-arity
> > generics, but I'm not sure it's worth it...)
>
> I tried that at the time, but IIRC it made things too complicated. It
> should be possible as long as all arities are distinguishable (maximum
> of one `rest' arity, and all other arities smaller than that), but the
> implementation is not going to be fun.
>
> --
> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
> http://www.barzilay.org/ Maze is Life!
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
--
~jrm