vvvv / VL-Language

The official repo for the design of the VL programming language
31 stars 0 forks source link

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

Open texone opened 1 year ago

texone commented 1 year ago

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 commented 1 year ago

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

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 commented 1 year ago

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

gregsn commented 1 year ago

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.