| Bruce Stephens 2006-09-28, 7:02 pm |
| Neil Madden <nem@cs.nott.ac.uk> writes:
> Bruce Stephens wrote:
[...]
>
> That is true. I'd still prefer to have both forms of scope capture
> available, as in Smalltalk etc. Using a single-method object, with
> all the baggage of (multiple) inheritance and so forth, just seems a
> bit too heavyweight for many cases.
Maybe.
I'm just thinking that one of the objections against adding closures
to Java and C++ is that you can get almost the same effect just by
putting whatever you want saved in an object. But then that forces
you to list everything you want saved, whereas you don't with
closures. But if you have to list things with closures, then that
seems to me to weaken the case for closures quite a bit.
Maybe I'm thinking in terms of static languages (where if you create
an object without any inheritance or anything then it never has
inheritance, so it has no particular overhead).
|