Time macros: use tryfinally macro approach#39138
Closed
IanButterworth wants to merge 3 commits intoJuliaLang:masterfrom
Closed
Time macros: use tryfinally macro approach#39138IanButterworth wants to merge 3 commits intoJuliaLang:masterfrom
IanButterworth wants to merge 3 commits intoJuliaLang:masterfrom
Conversation
Member
Author
|
If this is preferable, it should probably go into the next 1.6 beta etc. @JeffBezanson ? |
Member
|
I don't think it's worth switching to this. |
Member
Author
|
Ok! |
Member
|
Interesting. This looks great. Makes sense that we want to wait for #39217. In the meantime, just to be sure everyone knows, we realized that the current julia> @time begin
# The following exception disables compilation time measurement
try throw("ha HAH!") catch end
@eval module M ; f(x) = 2*x ; end
@eval M.f(2)
end
0.006116 seconds (2.17 k allocations: 156.874 KiB)
4So this fix would definitely be nice. 😊 Does it still make sense to wait for #39217? How's the progress there? |
This was referenced Aug 18, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@KristofferC's suggestion in #39133 of the
@tryfinallymacro approach is a neat way to maintain scope while ensuring the finalizer is runI verified that the finalizer is run in each of these:
This new
@tryfinallymacro could be pretty useful! Perhaps in a future PR@trycatchcould be added and both exported