-
Notifications
You must be signed in to change notification settings - Fork 56
Make block #245
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
Make block #245
Conversation
|
If I understand this correctly you want to bring a similar syntax to what Chain.jl offers? |
|
The implementation is similar, yeah. Turn a collection of args into a I need to think harder about what I do and do not want to allow, as I think being too flexible adds a lot of complication. I'm surprised that tests fail, they passed locally. |
|
Chain.jl seems to have figured this out, actually. cc @jkrumbiegel For instance, the following works in Chain.jl |
|
This roadblock has been solved. It was an optimization that was introduced in the anonymous functions PR. I have fixed it by removing |
pdeffebach
left a comment
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.
Ready for a review!
| # recursive step for begin :a + :b end | ||
| if function_expr isa Expr && | ||
| function_expr.head == :block && | ||
| length(function_expr.args) == 2 # omitting the line number node |
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.
I just call Base.remove_linenums! wherever possible, which changed the way we index expressions in a few places.
|
Okay I've cleaned up the One thing in particular to look at is the |
|
I've simplified the implementation and changed the docstring for |
|
Interesting! Have you thought about the possibility to support advanced syntax allowed by
Isn't it a problem to remove line numbers? Aren't they necessary to print accurate stacktraces in case of errors? (That's really a strong point compared to dplyr where I remember having a hard time finding out which lines generate errors.) Finally, I guess the idea is to extend this to |
I don't think so. This leads me to a design question: Is it weird to have In
Yes, If you think the tests and docstring are good for |
You would think so, but we are no worse than in 0.6.0, before the parsing re-write where I dropped line numbers. I think part of this might be due to Chain. We seem to get the line number of the start of a This needs a separate investigation later on. If we find that these line number removals are causing problems, I can fix them later. But it's likely upstream. |
|
w.r.t. line numbers. I think we are in the clear. With this script We get the error In |
|
@nalimilan this PR should be ready for a review, if not merging. I added docstrings and tests for everything. I didn't change |
Co-authored-by: Bogumił Kamiński <bkamins@sgh.waw.pl>
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
|
Fixed conflicts with master branch after #247 Still ready for a review. |
bkamins
left a comment
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.
Looks good.
nalimilan
left a comment
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.
Sorry for the delay. Just small details about the docs.
src/macros.jl
Outdated
| group, and returns a fresh `DataFrame` containing the rows | ||
| for which the generated values are all `true`. | ||
| Inputs to `@where` can come in two formats: a `block`, in which case each |
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.
"Block" isn't a language keyword, right? Also isn't super easy to understand. Maybe "as a begin... end block" and say "line" instead of "argument"?
(Same for other functions.)
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.
Fixed all of these.
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
|
Thanks for the review. I have fixed all the issues. Once tests finish this should be ready for merging. |
|
Thanks! |
With this PR we have