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

New ProtoFlux Node: Is Assignable From #3003

Open
JackTheFoxOtter opened this issue Sep 24, 2024 · 4 comments
Open

New ProtoFlux Node: Is Assignable From #3003

JackTheFoxOtter opened this issue Sep 24, 2024 · 4 comments
Labels
enhancement Suggested addition of a new feature. protoflux

Comments

@JackTheFoxOtter
Copy link

Is your feature request related to a problem? Please describe.

Currently, there isn't a nice way to determine wether a Type is assignable from a different Type in ProtoFlux. This information can be useful in a variety of situations in which you need to analyze generic runtime types.

Describe the solution you'd like

A new ProtoFlux Node Is Assignable From that takes in two Type inputs and outputs a boolean wether type A is assignable from type B.

Describe alternatives you've considered

You can create an explicit cast and check if it was cast successful (not null), but that has readability problems, and I think conceptually a type check like this should be done before before the type is used / cast, not after it.

Additional Context

No response

Requesters

No response

@JackTheFoxOtter JackTheFoxOtter added the enhancement Suggested addition of a new feature. label Sep 24, 2024
@shiftyscales shiftyscales removed their assignment Sep 24, 2024
@BaxterOttoman
Copy link

What if you sort of combined a cast into it too? So you have a reference and a Type as inputs and then it outputs a boolean value and the result of the cast?

@Nytra
Copy link

Nytra commented Sep 24, 2024

I think casting is a bit of a heavy operation to do if it's not needed, maybe better to just have the check without casting

@JackTheFoxOtter
Copy link
Author

I don't think I'd like combining the two in one node. Also that would require the node to be generic, which adds complexity.

This node is for type inspection, I don't think it should do more than that.

@yoshiyoshyosh
Copy link

yoshiyoshyosh commented Sep 26, 2024

I've had a few cases where this would be useful--introspection without actually casting the object (because it is a heavy operation!). Would love this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Suggested addition of a new feature. protoflux
Projects
None yet
Development

No branches or pull requests

5 participants