Is there a way to have an iterator finalizer? It can be used to release allocated resources (close files, disconnect, etc) in case of `break` or if an exception is thrown.
Consider the following example:
iterator foo(): int =
var a = init()
while a.hasNext():
yield a.nextValue()
a.cleanup()
for i in foo():
discard # OK
for i in foo():
if i == 0:
break # Bad: cleanup() is not called
Run
