On Thu, 12 Feb 2015 13:21:07 +0000, Paulo Pinto wrote: > On Thursday, 12 February 2015 at 09:41:50 UTC, ketmar wrote: >> On Thu, 12 Feb 2015 09:26:12 +0000, Kagamin wrote: >> >>> That's a repetition of C++ atavism, that resource management == memory >>> management. IStream is a traditional example of a GC-managed object, >>> which needs deterministic destruction, and not because it consumes >>> memory, but because it encapsulates an unmanaged resource, it has >>> nothing to do with memory management, malloc and free. >> >> p.s. istream example is bad. what it does is simply highlighting the >> fact that there is no way to do deterministic management with GC. > > Other languages manage to do it with scopes (e.g. using/lambda > expressions) and phantom/weak references. > > The only downsize it that it isn't as simple as a C++ destructor.
but we have scopes and weak references in D too! i'm still enraged that i can't overload `new` and forced to use ugly `emplace!` and friends, but otherwise it's possible (albeit a little burdensome) to do refcounting for interfaces. what is bad is that programmer has to be *very* careful with that. even seasoned programmers can made some errors here, that's why reference counting should be as much compiler-controlled as it can be.
signature.asc
Description: PGP signature