Skip to content

Conversation

@PoignardAzur
Copy link
Contributor

Fixes the issues encountered in #1099.

@PoignardAzur
Copy link
Contributor Author

Philip suggested using type composition instead, which we might adopt. This is more of a short-term fix.

See discussion on zulip: #xilem > Refactor property system to use a composition property view.

Copy link
Contributor

@Philipp-M Philipp-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, should at least unblock more than 12 properties.

I don't think though the trait PropertyTuple is necessary anymore though is it?
Could just be normal methods on all the Props types.

Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good - I'd like to see better handling of the new public API which this creates.

I think that having PropertyTuple still is reasonable - it ensures that the new methods have at least some basic docs and consistent semantics. It does need have its docs changed, at least, in this PR, and probably also to be renamed.

type $Props = ($(Option<$Type>,)+);

#[expect(missing_docs)]
pub struct $Props($(Option<$Type>,)+);
Copy link
Member

@DJMcNab DJMcNab Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this pub? I don't think this type is going to be part of the public API of any widget, nor have any stability guarantees.
I think it should at least have some basic docs if you're going to make it so.
Or it should be expect(unreachable_pub), if it's for the associated type on Style

(it probably should have some basic docs anyway, even just mentioning that you should call rebuild_properties in rebuild and build_properties in build, and initialise it with Default)

Copy link
Member

@DJMcNab DJMcNab Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment still stands - I'd like to understand why this type is pub before approving. I see that you've added the requested docs - thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right, forgot to answer. Sorry.

It needs to be pub because it's used as an associated type for the various implementations of the Style trait, and you're not allowed to do that with a private type. We could do a pub-in-private trick or something similar, but I think just making it a pub item works for now.

Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable enough. I have a small follow-up I'd like to do

@PoignardAzur PoignardAzur added this pull request to the merge queue Jul 18, 2025
Merged via the queue into main with commit 7f6c3ae Jul 18, 2025
18 checks passed
@PoignardAzur PoignardAzur deleted the fix_xilem_properties branch July 18, 2025 16:10
github-merge-queue bot pushed a commit that referenced this pull request Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants