-
Notifications
You must be signed in to change notification settings - Fork 370
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
Look for o!-syms in (flatten args) of defmacro! #1637
Conversation
I don't understand your example. I don't know what you expect the lambda list |
We're removing Python 3.7 on Travis (#1631), but all other Pythons should still pass. |
@Kodiologist I was using a slightly old version of hy, hy-0.14.0+92.g4d98cde, and when I updated to hy-0.14.0+169.g79bd4b0 rply-0.7.6 today, I got the same error as you. Seems to me that something is broken, since now I can't do
which I could before, and I expected it to work (the About my example: I don't know which part you don't understand, so let me explain everything. No doubt I will explain something that you already know. My
In
I use
which is quite a bit longer that my version with Additionally, without my change, I noticed that not only can one not have o!-syms in destructuring lists in the macro arguments, one can't have destructuring lists at all, since |
We've already removed tuple unpacking in lambda lists. #1590. We might still see nested lists in the defmacro lambda list when using The new model patterns might be a better option for defmacro anyway. I'm not sure if we still want |
Ah, so you meant to do unpacking. That makes sense. But as Matthew points out, unpacking in lambda lists was recently removed, and if you want to look for o-parameters in In any case, be sure to add a test for your new feature. |
I tried to look at all the issues related to removing tuple unpacking in lambda lists, but I didn't really get what the alternative is supposed to be. Is there currently an alternative or is this a work in progress? |
There's been some work on fancier unpacking (#1328), but nothing has landed yet. |
Python 2 had this and it was removed in Python 3. We've followed suit, since the implementation would be more complicated in Python 3, we decided this feature belongs in macros build on So besides my destructure macros, you can work around this the same way as is recommended in Python: with an assignment at the top of the function. Note that in Hy, |
I guess my dream of having o!-parameters in unpacking lists will have to wait. But since So anyway, what do you think of this?
|
Try adding a test. |
I might have discovered a problem with the tests. I was trying to add a test in So, it is just for me that the functions ending with |
It's not just you. That's a regression I introduced that #1625 fixes. Sorry about that. |
Ah, OK! I added some tests. |
@gilch Oh, missed your comment there. When you say I can work around it, do you mean privately, or do you suggest I submit an updated version of
|
Being able to have o!-symbols in lists nested in the arglist of
defmacro!
seems like a good idea to me. Otherwise one couldn't do things likeIf this is not allowed,
defmacro!
is pretty useless for writingif-let
in particular; at least I think so.The tests didn't pass before I started. :P