-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Julia hangs on shell command in macro body #2378
Comments
This fixes it, @loladiro and/or @vtjnash can review:
The problem is that the I do suggest making macros pure functions. With this change, the code should work for now, but I can imagine strange problems where things don't get expanded when or as often as you want. |
That seems extremely weird to me, but I have no real objection to it either. It seems to me however that the only general fix for this is to never parse code inside an event handler, which I don't think is feasible. |
I'll have to think on this some more. I don't like the implications of making this async (it's called on every keystroke). However, I hadn't contemplated the possibility that this could block, since seemed it shouldn't be executing code until it was back in the main thread. I guess we could set up a dedicated stdin reader task. However, I'm inclined to think code compilation needs to be delayed. |
I agree, for the repl at least, it would be better to delay expansion to when the input is executed. |
Conceptually, it is much easier to write macros if they can do anything a function can do, i.e. if they act just like a function that returns an expression, albeit evaluated at parse time (or better yet, compile time). Restrictions that the macro body be pure may be hard to enforce; in my real situation, for example, the In my particular case of |
Update: I found a workaround for my Of course, then I immediately ran into another bug (#2386), but that bug I could work around with global variables. |
The following command hangs for me (Debian GNU/Linux x86_64):
(Why am I doing this, you ask? I have a
@pyimport
macro that imports a Python module, which needs to initialize Python, which needs to run thepython
executable to obtain the shared-library name.)The text was updated successfully, but these errors were encountered: