-
Notifications
You must be signed in to change notification settings - Fork 207
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
let vs set in new columns #6
Comments
How about removing the keywords and using Golang's solution for this? It's rather concise.
|
I had the same initial thought, but there was fairly broad feedback that always leading with a keyword was more consistent and easier to scan, and after making the change I empathize (max-sixty#2)... (though I agree that the golang is nice had we not decided to lead with a keyword, thanks for the suggestion @RCHowell ) |
Makes sense. Just my opinion, but the I feel the declarative nature of assignment interrupts the functional flow. I'm curious what you think of having an explicit projection function to maintain this functional nature. Then the projection fits in just like any other transformation/operation/iterator
|
Yes, that's compelling: from employees
project [
gross_salary := salary + payroll_tax,
first_name = uppercase(first_name)
] ...could be great. And if we figured out whether a single item can be a list, then it could just be I wonder what people think of |
FYI @hadley likes |
I like the distinction of := and = in Golang, but personally don't think it belongs in PRQL , because people other than programmers will be using this , and the set/let keywords flow and look better with the language and I think its more obvious what they do ( for non programmers or people not used to assignment vs declaration operators ). I like derive probably the best word for this operation ... but let/set just seems to fit so nicely here, I still vote let/set. |
IMO |
Thanks @hadley . Would you recommend we have |
I don't find the distinction that important, although I can see that it might be nice to be explicit about overwriting an existing column (but you'd need to figure out if that explicitness is something that SQL programmers enjoy or find annoying). In hindsight, I'm not sure I'd keep |
One more thought: it's also really nice to be able to write |
In my opinion, Something to consider is the argument to this operator |
justinpombrio makes a good point:
I think this is a good idea! dplyr has something similar with
mutate
&transmute
.It can mostly be enforced by PRQL. There's a case where we transpile to:
...where we don't know whether or not we're overwriting an existing column. But it's a minority of cases, and the contract could stand within PRQL.
let
&set
seem reasonable but also open to other syntax.The text was updated successfully, but these errors were encountered: