https://pantsbuild.org/ logo
w

witty-crayon-22786

05/03/2023, 11:47 PM
fairly fundamental proposal: https://github.com/pantsbuild/pants/issues/18895 … syntax bikesheds welcome.
🎉 3
👀 3
w

wide-midnight-78598

05/04/2023, 12:23 AM
Huuuuuge +1 to move to a more "standard-ish" syntax.
🎉 1
h

hundreds-father-404

05/04/2023, 3:25 AM
Thanks for thinking of this! I generally would be in favor of making explicit what rule you are calling. I like that it will make Pants feel less magical and the benefits you describe like better error messages I'm nervous if people will be confused with the proposed syntax, though. Specifically, it is rare that you want to use "multiple Params" (capital p), right? It makes the rule graph much more complex. I fear people will end up confusing normal lowercase params with uppercase Params I'm wondering if we could have some other syntax to make it more clear this is not a normal function call. But, you do still have to explicitly declare the rule name. Something like:
Copy code
await Evaluate(the_rule)
await Evaluate(the_rule, Param1)
Or, probably confusing, but maybe even
await Get
still, and change the first arg to be the rule name rather than the return type -- Another challenge with the proposed syntax is MyPy. I think it will complain about invalid calls to the rule functions. You can avoid that with some special syntax like
Evaluate(the_rule)
or
Get(the_rule)
b

bitter-ability-32190

05/04/2023, 11:08 AM
Yeah I like the idea, but think the syntax needs some TLC. I bet there's a way we can keep the
await rule_name()
syntax but make all the other requirements work, like MyPy and engine-supplied-args
👍 1