encore
encore copied to clipboard
Add finalisers to Encore
The run-time supports finalisers. We should support them at run-time in Encore too. There are some rules for finalisers that should be. From the Pony language:
Finalisers are special functions. They are named _final, take no parameters and have a receiver reference capability of box. In other words, the definition of a finaliser must be fun _final(). The finaliser of an object is called before the object is collected by the GC. Functions may still be called on an object after its finalisation, but only from within another finaliser. Messages cannot be sent from within a finaliser. Finalisers are usually used to clean up resources allocated in C code, like file handles, network sockets, etc.
We should figure out what is the story for finalisers for Encore. For example, because we have another type system, maybe we can support other things like message sends in finalisers, etc.