On Wednesday, 30 October 2013 at 20:35:14 UTC, Peter Alexander
wrote:
I think not running the destructor is the best option (although
to be honest, I'm not a huge fan of closures to begin with, for
exactly these sorts of reasons -- they only really work well in
a pure functional setting).
I disagree. Closures work well in Scheme (more generally, Lisps)
and ML, which are not purely functional languages. In SICP *, the
combination of closures and mutable state is used to model OO. I
used closures more than I used OO in OCaml.
Things are trickier in D for a trickier of reasons. You may be
right about not running the destructor; I'm still thinking about
it.
-- Brian
* The Structure and Interpretation of Computer Programs by
Abelson and Sussman, for those who don't know.