Python syntax in Lisp and Scheme

Erann Gat my-first-name.my-last-name at jpl.nasa.gov
Thu Oct 9 11:44:08 EDT 2003


In article <bm32a3$iti$1 at bob.news.rcn.net>, "Vis Mike"
<visionary25 at _nospam_hotmail.com> wrote:

> "Erann Gat" <my-first-name.my-last-name at jpl.nasa.gov> wrote in message
> news:my-first-name.my-last-name-0810031201410001 at k-137-79-50-101.jpl.nasa.go
> v...
> > In article <xcvfzi3r2ge.fsf at famine.OCF.Berkeley.EDU>,
> > tfb at famine.OCF.Berkeley.EDU (Thomas F. Burdick) wrote:
> >
> > > > method overloading,
> > >
> > > How could you have both noncongruent argument lists, and multiple
> > > dispatch?
> >
> > C++ seems to manage it somehow.
> >
> > #include <stdio.h>
> >
> > void foo(int x, int y) { printf("1\n"); }
> > void foo(double x, int y) { printf("2\n"); }
> > void foo(char* x) { printf("3\n"); }
> >
> > main() {
> >   foo(1,2);
> >   foo(1.2,2);
> >   foo("foo");
> > }
> >
> > compiles and runs without complaint.
> >
> > E.
> 
> Ahh, but overloading only works at compile time:

That's irrelevant.  When it happens doesn't change the fact that this
proves it (multiple dispatch with non-congruent arglists) is possible. 
Nothing prevents you from using the same algorithm at run time.

E.




More information about the Python-list mailing list