-
Notifications
You must be signed in to change notification settings - Fork 2
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
Ability to work with generic types in ProtoFlux. #3241
Comments
Boxing / unboxing doesn't change anything here. You cannot use generic nodes without specifying an explicit type to use presently. |
There's another use-case for this. Once we get nested nodes (#564), it would be extremely useful to be able to specify our own custom generic nodes, for example math operations that work on all number types. Otherwise you'd be required to create multiple versions of the same node for multiple number types, which would quickly become a lot of work, especially if you need to then make a change to them. |
You can use |
That is functionally identical to casting the input to |
Is your feature request related to a problem? Please describe.
This is a thing I've come across a couple of times now, and I think it would be a nice addition to ProtoFlux to simplify / generalize some setups. Note that I'm not quite sure how a solution to this could look like, but I do want to explain the problem with an example:
I'm writing a piece of code that operates on an
IField<T>
input object. After the operation, it is supposed to write theIField<T>
into a dynamic variable. The problem I'm having is that I presently don't have the ability to write this code in a generic way. I can treat the input object as anIField
reference by casting the input type (ex:IField<string>
->IField
), but that's where the generalization options end. Currently to callWriteDynamicObjectVariable<T>
, I need to choose a type when spawning the node. (So for exampleWriteDynamicObjectVariable<IField<string>>
). This means that I now need to check my input type, figure out what generic type it corresponds to, and call the correctWriteDynamicObjectVariable<T>
node for that type, instead of being able to write the code in a generic way. This requires me to hard-code in what types my code support, which is pretty ugly and laborous.Describe the solution you'd like
I'd like to be able to work with generic types in ProtoFlux. I want to be able to write code that calls a generic node in a generic way.
Describe alternatives you've considered
Hard-coding in supported types, but as pointed out, this is pretty limiting.
Additional Context
No response
Requesters
No response
The text was updated successfully, but these errors were encountered: