David Abrahams wrote: > I'm sure I missed something important along the way here, but the fact > that you can generate Java bytecode for Python's "finally" in Jython, > it seems to me, _proves_ that you can also generate code to that will > be executed at the end of a function even in the presence of > exceptions. Certainly. However, I'm uncertain whether you find out, in this finally block, what objects require this finally-ization. Part of this uncertainty comes from my failure to understand how the proposed mechanism works in the first place - ie. what is the precise set of objects that should be finally-ized. If any algorithm for such a mechanism would need to find out what objects have been created while the function was running, and invoke finally-ization on those, that may not be possible to implement: you can't get hold of all objects that have been created in Java, AFAIK (1). If it involves looking at all local variables, it might be implementable, but might cause a significant slowdown even if the feature is not used. Regards, Martin (1) that is currently not possible in Python, either, but it might be possible to change the interpreter to record the list of young objects in the thread state.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4