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

[Proposal] Keep original Type when calling supertype methods #59

Open
texone opened this issue Mar 21, 2023 · 3 comments
Open

[Proposal] Keep original Type when calling supertype methods #59

texone opened this issue Mar 21, 2023 · 3 comments
Labels

Comments

@texone
Copy link

texone commented Mar 21, 2023

In the current implementation the type you call a function on gets reduced to the supertype the type output of the function should be the same as the input to be able to chain it nicely
image
As in this image the input of setValue is textureInput but the output is Abstract Input

@gregsn gregsn added the proposal label Jun 3, 2023
@gregsn gregsn changed the title Keep original Type when calling supertype methods [Proposal] Keep original Type when calling supertype methods Jul 15, 2023
@gregsn
Copy link
Member

gregsn commented Jul 15, 2023

A) One way of looking at this request is this:

  • The state output of mutable types was invented by VL just to make it easy for the user to chain operation calls and keep side effects in check.
  • So it's an artificial pin.
  • We could change the target code so that on definition side the pin doesn't really exist. On application side, we could just further operate on the mutated object that we fed into the node.
    grafik
  • The vertical line is meant to visualize that the ongoing instance == the outgoing one.
  • So for the artificial state output pin it would definitely be type-safe to use the compile-time type of the datahub the state input pin is connected to upstream.

B) Another way of looking at it would be to keep the Stateoutput on definition side and to make everything generic:

class SuperType
{
  public TInstance Foo<TInstance>() where TInstance : SuperType
}

class SubType : SuperType
{
}


A) simplifies target code
B) makes target code more complex

so A) would be desirable.
However, we should discuss the record case as well.

@azeno
Copy link
Member

azeno commented Jul 17, 2023

A) is a good idea. I think we discussed and rejected B) quite some time ago.

@gregsn
Copy link
Member

gregsn commented Aug 2, 2023

C) all subtypes have corresponding nodes for all inherited operations from all supertypes. Their state input and output pins are typed with the subtype.

When navigating into an interface e.g. Channel we see all the inherited operations from Channel (Ungeneric): LatestAuthor. Until now, we don't see the inherited operations, which can be very confusing. There are other ways to tackle this (e.g. just make the node browser more clever), but tackling the issue this way by introducing more node definitions - one for each subtype - solves the quest here and in the node browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants