On 2013-10-30 21:35, 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 use Ruby all day with a lot of blocks (closures) and I never had any problem. In Ruby everything is an object and passed around by reference. I guess that's help.

BTW, the default iteration pattern in Ruby is to use blocks:

[1, 2, 3].each { |e| puts e }

Closest translation in D:

[1, 2, 3].each!(e => writeln(e));

But in D one would of course use a foreach loop instead.

--
/Jacob Carlborg

Reply via email to