[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] Finalizers

I've been working with finalization system, and I've run into a problem. First, are finalizers actually intended for use? I can't find anything in SC that uses them.

The problem I'm having is that the finalize function will occasionally be called in the middle of a chain of messages. For instance:
g = NSColor.alloc.init;

Here the finalize function will be occasionally be called between the alloc and the init. NSColor.alloc's return value isn't referenced at that point, so it makes sense that it is getting collected, but I can't imagine this being the correct behavior. This example works fine when it is separated into:
g = NSColor.alloc;
g = g.init;

I'm setting up the finalizer using InstallFinalizer().