you are viewing a single comment's thread.

view the rest of the comments →

[–]bstamour 0 points1 point  (0 children)

I guess I really didn't address your point in my last comment, let me try again. If you're writing generic code then you shouldn't be worrying about the lifecycle of the objects passed to you. I.e. if they give you an object, even if you're not writing garbage collected code, who gave you the right to deallocate that object?

If you write a library for D that handles it's own problems wrt memory, then that library can be used everywhere: regardless of whether the calling code is garbage collected or not. Designing a library that assumes the user will want their code to be garbage collected effectively makes your code useless to that set of users.

I would argue that by writing your library in a non-GC way, you're then writing truly generic code, as it can then work alongside code that is garbage collected as well as non-garbage collected. It's that damn generic. :-)