-
Notifications
You must be signed in to change notification settings - Fork 70
Description
bracket and finally check for exceptions so that they can release the resource on exception. However this is very expensive and blocks fusion. The current version of bracket releases the resource on GC. If we do not proactively check for exceptions and do not release a resource on exception, the resource will finally be released on GC. This will make bracket much faster, at the expense of promptness of releasing the resource on exception. Note that it will still be promptly released in the normal path when the stream is done. The exception may anyway be handled somewhere up and as soon as the resource is not referenced it will be freed on GC.
Therefore, we can have two versions of bracket:
- the default
bracketcan have a less prompt but faster behavior - a stricter version
bracket'can have the current prompt release on exception behavior
Same applies to finally. Even after can have similar behavior.