[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: What's so cool about Scheme?
At 08:23 PM 2003.06.03 -0400, Anton van Straaten wrote:
>Mike Newhall wrote:
>I can sort of agree with that, but really, without closures, people will -
>and do - use all sorts of hacks anyway - objects, for example ;o)
As an aside, although I don't remember the exact argument, Christian Queinnec in LISP In Small Pieces made the case that, although many people consider objects to be 'poor man's closures', closures are in fact poor man's objects (in his opinion).
>I'm not understanding how you're relating this to eval. Certainly, an eval
>capability will be more powerful in the presence of closures, but that's
>because a language with closures is more powerful than one without, it
>doesn't have anything to do with eval itself.
Really the point I am making, as before, is that eval really doesn't work for HOF's, and leads to the need for closures. Of course if you start out with closures but no eval, as some languages do, one is never tempted by eval. Although a language can be quite useful with closures but no eval, you wouldn't want a language with eval but no closures.
>The original Lisp had first class functions, but didn't implement closure
>behavior correctly. It would have had the funarg problem even if it didn't
True, my point always was that once you have code=data without closures, you automatically get the funarg problem, regardless of whether there are first-class functions. First class functions, implemented naively, could be considered equivalent to having 'eval', as the function object could be string-replaced with its body.