-
Notifications
You must be signed in to change notification settings - Fork 55
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
silent error when using ,
in operations
#320
Comments
Weird, thanks for the issue report. I would have expected the last one to sort the tuples lexicographically, but it does not seem to do that. |
oh wait, it is sorting the tuple lexicographically. But within this it's sorting the arrays lexicographically. This is "right" in the sense that it's behaving as Julia behaves, but it is unintuitive behavior.
with
so we see
Sorry, i'll finish writing this up tomorrow |
Okay I'm back. Here's whats going on. The transformation
creates a tuple of vectors. Because a
works. So it's creating the data frame
and then sorting by the I agree that it's very confusing that One potential solution is to disallow expressions that look like Now that you understand what DataFramesMeta.jl is doing behind the scenes, do you have more thoughts on how to approach this issue? |
So in essence:
is the same as
due to how Julia parser works. Right? |
Yes, exactly. |
I'm not sure what the correct solution here would be. Maybe we document the use of tuple in such cases, which is essentially equivalent to writing the syntax with the parenthesis. So maybe just Advocate the use of one common syntax rather than two different ways of writing? Given a choice, to be consistent with dataframes.jl, it is probably easier to write the macros with parentheses and start deprecating the one without. It will be consistent also with the syntax that is used in R where most of the users are coming from |
This is what I do (i.e. I always use a function call style). But we cannot "deprecate it" - this is an intentional feature of Julia not of DataFramesMeta.jl. |
Yes, this doesn't fully solve the problem, since
The reason we support the non-parentheses version is because of
will get parsed as
the solution to this problem was to allow multiple lines so the macro-flags could get properly parsed
Yes but I think the way forward is to disallow |
I'm not sure that helps, as you can of course disallow a tuple, but you would also need to disallow macros that work on tuples. This is because One solution would be to disallow multiple arguments except listed in a The premise of this whole issue is that there is a silent "error", but of course it's not that, it's just confusing syntax. But given that Julia's macro parsing rules are fixed and you can't discriminate between a call with or without parentheses inside the macro, I think this is just not avoidable. |
This was my point above. I think it is best to very clearly explain the options and their consequences in the manual. @pdeffebach - if you prefer I can submit a PR. |
Maybe we need a "Gotcha's" section of the docs? Could be a good opportunity to beef up the docs before 1.0. |
consider the use of
@orderby
below. Look at the last example. Somehow, the syntax allows the use of,
does not error, but provides an incorrect result.The text was updated successfully, but these errors were encountered: