-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow variable assignment with @infiltry #118
Conversation
I don't think this is the correct fix because it makes
instead. |
Ah you're right, we could potentially manipulate the expression as
if |
Yeah, but I still think that's not really worth it. Most* macros like this return their value, so
|
Yeah but what's unexpected is that the macro creates a new scope? I mentioned the new macro to someone and their first reaction was "oh I cannot assign variables using the macro" (unlike |
I went forward with my proposal. Also, I don't know if it was intentional but the exception was not |
Yeah, we definitely should Also, can you please add a new test instead of modifying the old one? |
So you mean in the case someone would do: @infiltry begin
x = 3
y = 2x
end
Yep, will rework the tests. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #118 +/- ##
==========================================
+ Coverage 76.53% 76.61% +0.07%
==========================================
Files 1 1
Lines 439 449 +10
==========================================
+ Hits 336 344 +8
- Misses 103 105 +2 ☔ View full report in Codecov by Sentry. |
@@ -111,19 +111,49 @@ end | |||
Wraps expression in a try block, infiltrate if an exception is raised. | |||
Equivalent to: | |||
|
|||
```julia |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need the indentation here if you add the fence.
Would also be good to add the rethrow
s in both cases.
$(esc(expr)) | ||
infiltrator_catch_and_rethrow = quote | ||
$(Infiltrator.start_prompt)($(__module__), Base.@locals, $(String(__source__.file)), $(__source__.line), ex, catch_backtrace()) | ||
rethrow(ex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rethrow(ex) | |
rethrow() |
is more correct I think.
This will allow for code like
to work.
Otherwise,
x
will be only defined in thetry
scope.