On Thu, Jan 01, 2015 at 01:04:22AM -0200, Marcos Douglas wrote: > > > > This is totally new for me. I have used interfaces a lot, and while I had > > trouble from time to time, I haven't really encountered these. > > New? What do you mean? > This problem was talked in FPC list and here before. > I use "weak reference". Somethings are not possible to implement > without this "technique". > For example: > https://github.com/mdbs99/AWS/blob/master/src/aws_s3.pas#L166 > https://github.com/mdbs99/AWS/blob/master/src/aws_s3.pas#L304 > > These objects have circular reference and they need weak reference to > keep memory safe.
Ah, you mean that. I didn't consider that an interface problem, since the ref is in an object. (whose aren't refcounted). IOW by design :-) > > eachother. The major implementations are somewhat hardened against it, but > > more involved reference counting implementations (like Python) are too. > > I know some others approaches have problems, but Delphi/FPC is not perfect > too. Certainly. It doesn't even try, and as soon as you try to overuse it, it breaks down. It is IMHO a designchoice and not a flaw though. > > Delphi/FPC reference counting is simple and cheap. The problem is IMHO not > > the implementation, but the fact that people try to abuse it for things it > > wasn't meant for (a holistic automatic memory management solution). > > I agree. Then why do you write such code ? :-) > > ARC is IMHO no solution but only damage control (by explicitely naming pure > > references). IIRC Python has similar tricks to keep circular detections > > cheap (cycle checking can stop at a weak reference) > > Happy New year! Happy New Year. May 3.0 be all that we hope it will be. -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus