-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
Derive skip #251
Derive skip #251
Conversation
Note that this is based upon my previous PR (which should obviously be merged first) |
2e6c68f
to
16f9562
Compare
added missing godot::builtin::, sorry about that |
bcd7603
to
b33fa93
Compare
There are merge conflicts, could you resolve them please, @astrale-sharp? |
ac1b06c
to
6a5f519
Compare
API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-251 |
What are your plans with this PR? CI is currently red, and there is stll the open question how we should deserialize a struct with a skipped field. What value should it get? |
For me it should get Default::default() yes, unless a #[variant(default = ...)] is there. Originally i was blocked by ./check.sh itest crashing but this seems to be resolved so I'm going to work on this ! |
6a5f519
to
c01841b
Compare
It may be worth rebasing onto latest |
0fff03f
to
75f9ee8
Compare
Hi! I added functionality to filter test, i still need to update the chech.sh docs but you can now run ./check.sh itest substring, (it would only run test containing substring) added basic skip attributes using default, next part is support for specifiying the default in your attribute. |
75f9ee8
to
de00bf1
Compare
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 added functionality to filter test, i still need to update the chech.sh docs but you can now run ./check.sh itest substring, (it would only run test containing substring)
if you want it in another PR just say so, no problem.
Yes, please don't mix unrelated functionality in the same PR unless it was previously agreed. This PR should ideally focus only on the skip changes, as advertised in the title.
but you can now run
./check.sh itest substring
This syntax is used for listing the tasks that check.sh
has to run: test
, itest
, clippy
, doc
etc. So it would be confusing to recycle it for filtering. An explicit --filter
argument would be more intuitive (but let's discuss this in another PR).
In general, it would be nice if I didn't have to repeat comments I already gave multiple times before. One of them is the formatting of quote! { ... }
macros, which I mentioned at least four times in your last PR (1 2 3 4). Unfortunately, this PR suffers from the exact same issues.
Reviewing pull requests takes a lot of time during which I cannot work on implementation, so I would appreciate if I could spend this time on more meaningful issues. We try to automate whatever we can for bikeshedding topics like formatting, but rustfmt isn't perfect, and so I rely on user cooperation. I know this wasn't on purpose, but please write those review comments down, use the "mark as resolved" feature or any other system that works for you. Thanks a lot for your understanding!
Regarding the failing Keep in mind though that our MSRV is currently 1.66.0, so the full CI would fail with newer features. Theoretically we can update it, but I also don't want to always chase the latest release and force everyone to constantly update Rust, if it's only about smaller convenience features. Maybe the faster crates.io index warrants an update to 1.70 though 🤔 bors try |
tryBuild failed: |
My preferred solution is if you unsubscribe from my draft and then I @ you when I'm ready! |
after overriding my version to 1.66.0, i get clippy errors from changes not related to mine, should I fix them? (2 very easy fix) EDIT : problem doesn't appear on github checks cause the rust version for clippy if 1.70.0
|
20ec055
to
68d4594
Compare
In the future I'd like to add support for a if so we'd need to discuss the syntax, a few come to mind ( I'll copy this message elsewhere if you'd rather have a separate pr) struct UserStruct {
#[variant( skip = (default = %value% ) )]
field : ty
#[to_variant( skip = (default = %value% ) )] // same but only skip
} I feel like there is a better way to do this |
No, let's discuss separately. This PR is already open for 1.5 months, I'd like to wrap it up asap... |
Then I believe there's only |
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.
Unfortunately there are still tons of formatting issues. Please, please go through all your code and make sure macros are consistently formatted. In case of doubt, look at existing code. I'm sorry to be pedantic here, but we have to maintain the quality of code for readers and the alternative is that I have to fix all those little things myself. I'm also really disappointed in rustfmt to not catch any of these; might consider using an alternative formatter in the future...
Don't use match
if you only have true/false
branches; this is what if
is for.
The last thing: it would be nice if this macro got some documentation, otherwise you spent all that effort any people may not even discover this API. https://godot-rust.github.io/docs/gdext/pr-251/godot/bind/derive.ToVariant.html is currently empty. No need to write a novel, but maybe quickly elaborate the purpose and include 3-4 examples as doctests (you can even take those from the tests). Same for FromVariant
. Also explain the #[skip]
in particular.
68d4594
to
1e65600
Compare
738c25d
to
607c90c
Compare
@@ -389,7 +389,7 @@ fn variant_hash_correct() { | |||
gstr("string").to_variant(), | |||
varray![false, true, 4, "7"].to_variant(), | |||
0.to_variant(), | |||
dict! { 0 : dict!{ 0: 1 }}.to_variant(), | |||
dict! { 0 : dict!{ 0: 1 } }.to_variant(), |
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.
caught this with regexes
I used a set of regexes to help me, hoping i caught all the formatting problems. I don't have much motivation to keep working on this. |
607c90c
to
cdd4439
Compare
cdd4439
to
516f0e9
Compare
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 don't have much motivation to keep working on this.
Fully understandable. Maybe some tips for the future:
- Split the PR into smaller parts. This turned out to be quite an involved feature, but you could for example have started only with
#[variant(skip)]
for structs. This would reduce the amount of code to review, the amount of changes to address, and the overall work involved. Don't think you are expected to do "the full thing", a lot of additions are helpful in a partial state and can be extended later, by you or someone else. - Motivation is generally higher if the time between iterations is shorter. After several months, a lot of previous points are forgotten, it needs more time to re-think into the problem, etc. I understand there may be all sorts of RL reasons that delay pull requests, but having a smaller PR (point 1) would have the biggest impact here.
- Regarding the formatting stuff, I don't like to nitpick a lot, but at the same time please consider that work that is not done during the PR likely has to be done at some point in the future, and likely by me 😬 so I'd like to keep a level of code quality, if only because it helps other contributors navigate and recognize a consistent style. I hope that makes sense.
Thank you very much for your hard work on this feature addition, as well as the patience and persistence! 👍
bors r+
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
Adds variant(skip) To/FromVariant proc macro