Sig, Sounds good, with the possible exception of removing #remove:. Letting things happen is great, and giving the finalizer a recognizable name would be wonderful. Otherwise, one should be able to do explicit cleanup if desired[*]. Whether that applies to WeakRegistry, I'm not sure. I would want to be able to remove items from weak arrays, dictionaries, etc.
[*] I am thinking of things like tight loops with database activity, etc. There have been times when I have had to explicitly clean up finaizable things, and cleaning the weak registrations at the same time always seemed reasonable. Bill ________________________________________ From: [email protected] [[email protected]] On Behalf Of Igor Stasenko [[email protected]] Sent: Tuesday, July 12, 2011 10:13 AM To: [email protected] Subject: Re: [Pharo-project] Socket objects created twice ? On 12 July 2011 15:17, Schwab,Wilhelm K <[email protected]> wrote: > Rather than changing the handle (making it harder to associate the handle > with the "real" socket), it would be nicer to have a SocketFinalizer or > something - it could even be a subclass of socket?? > I just thought about it after posting previous mail. Yes it would be nice to add an explicit class, named SocketFinalizer and then add an inst var to Socket - a finalizer. Then when you deleting a socket, a socket could tell a finalizer to nil-out handle, instead of asking WeakRegistry to unregister the socket which is much slower. And a finalization action for nilled out handle will be no-op, once already closed socket become garbage. In that way, someday we could eliminate the #remove: protocol from WeakRegistry. -- Best regards, Igor Stasenko AKA sig.
