Skip to content
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

Improve or remove ChannelPlurality? #332

Closed
simbleau opened this issue Sep 21, 2023 · 4 comments · Fixed by #468
Closed

Improve or remove ChannelPlurality? #332

simbleau opened this issue Sep 21, 2023 · 4 comments · Fixed by #468
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@simbleau
Copy link
Collaborator

I'm not sure if anyone would agree, but I see the plurality as an ergonomic papercut on API usage, especially in Bevy.

commands.open_socket::<MultipleChannels>() and commands.close_socket::<MultipleChannels>() require generics, etc. which doesn't feel at all right.

I don't want to remove the SingleChannel API, since I think it's very helpful.

Perhaps the solution would be to make different traits that can be imported for Bevy?
e.g a ComplexSocketExt trait and a SimpleSocketExt which assume the plurality?

@simbleau simbleau added enhancement New feature or request question Further information is requested labels Sep 21, 2023
@johanhelsing
Copy link
Owner

I'm still not entirely convinced that the command extensions are a good idea... even though I think it was I who suggested it. It limits the API to a single socket, allows calling close_socket when there is no socket, what happens when you open and there already is a socket?

Operating on Resources/Components isn't much more complex and makes it a lot more flexible and makes it more understandable what actually happens?

@simbleau
Copy link
Collaborator Author

Yeah, I agree.

@simbleau simbleau added good first issue Good for newcomers and removed question Further information is requested labels Oct 31, 2023
@simbleau
Copy link
Collaborator Author

Ok, let's remove the Command extensions for now. I agree with the resource-driven approach.

re: generics, are we expecting users to do something like this, assuming they want to stay DRY?
I'm still not totally satisfied with it, but I'm ok with it.

type MySocketType = MatchboxSocket<SinglePlurality>;
...

app
   .add_plugins(...)
   .init_resource::<MySocketType>();
...
   .remove_resource::<MySocketType>();

@caspark
Copy link
Contributor

caspark commented Dec 10, 2024

Oh hey, I raised a PR for removing the Plurality business over at #468 , without actually realizing this issue exists - that's what I get for jumping straight into PRing before skimming the open issues :)

Re the command extensions: I used the bevy example to figure out how to get matchbox going in my macroquad game, and purely from that angle I would say that yes, I also think the commands are more confusing than they are convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants