-
Notifications
You must be signed in to change notification settings - Fork 43
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
named and optional IO #20
Comments
Hi @trporn, thanks for your interest in DSPatch! Connection by pin name string is certainly doable but arguably a cleaner, even less error prone way to do this would be to declare public enums for your IO in each of your components like so:
Regarding determining if an output is being used, no, not at this point at least. Because circuits are implemented as pull systems, components know only about the components feeding into them, not the ones they feed to. |
Oh wait, we do ref count component outputs. Your latter request may be doable. I will look into it :) |
Yeap, enum is a nicer way to go. You can use something like magic_enum from https://github.com/Neargye/magic_enum to automatically infer the number of elements in the enum, turn enums to strings etc. This would make the enum declaration replace the definition of the number of inputs/outputs, so the hassle is kept to a minimum.
I think it is generally desirable to be able to treat the whole circuit as a graph. This way you can answer questions like "what output changes if I changed this input?" or "which of the inputs influence that output" |
It is quite simple and refreshing indeed.
It would be nice to add named inputs/outputs so that components can be connected by name. It would be less bug prone, especially since the types are dynamic and there is no type safety on the bus.
Also, can a component know if a specific output is required by some future component or not? This is nice for performance reasons. If it is not needed, it can be skipped.
Thx.
The text was updated successfully, but these errors were encountered: