Re: Closures versus objects
Dave Roberts <[email protected]>
| Newsgroups | gmane.comp.lang.lightweight |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 2007-02-18 at 18:22 -0600, Paul F. Dietz wrote: > Pascal Costanza wrote: > > > > > On 16 Feb 2007, at 19:22, Gary King wrote: > > > >> If Lisp was re-written today, I'd guess that there would be more use > >> of generic functions for things like length. Then we would have: > >> > >> (length "butter") ==> 6 > >> (length #(1 2 3)) ==> 3 > >> > >> and so on... > > > > > > That's basically what happened in Dylan. > > > There's nothing that prevents LENGTH from being implemented as a generic > function in a compliant common lisp. Programs that depend on it being > generic will not be portable, however. Which brings up a good point. Given this observation, why wasn't LENGTH made a GF when CL was specified? Was CLOS such a late addition and everybody was afraid of the possible performance impact? Surely, there was not technical reason that it couldn't have been made generic, as you say; all old code would have continued working, no? Over the past couple years, I have really learned to appreciate CLOS and this is one of those examples where it seems like a good idea wasn't taken far enough. -- Dave