Closed gregsn closed 3 years ago
Regarding the details:
What shall happen when you annotate a pin with type parameter A
and it is connected to a node that feeds or accepts e.g. a Boolean
.
Argue!
Option A) Replace every occurrence with the concrete type If this type parameter vanished from the body of the patch (it got replaced everywhere, so no type annotation left with that type parameter)
type variable
which only gets used inside of a patch, helping out while patching, but currently we only have type parameters
, which are part of the signature of a type or operation. This notion of a type variable is not a free type variable, but a type parameter, which when used gets substituted by the type argument.Option B) No. Always keep the parameter. Never substitute The type unification has to collect all the constraints for the type parameter. In the end, it should check if these are valid type parameter constraints. If yes these are kept, otherwise we report an error.
I wanted to add that this proposal might give us a way out regarding another issue: calling operations on This
in generic patches is currently completely broken. We could say that self-referential generic patches will only work with explicit parameters.
Works for me
This got implemented for 2021.4. It's like specified here, but also comes with explicit type parameters for static operations. Layer operations still don't have that ability. Oh, and it's of course Option B): never substitute an explicit type parameter.
We want the user to be able to specify explicit type parameters on type definitions. This is necessary to solve Issue B mentioned here: #38
In the Name field you shall be able to write
MyClass<MyT1, MyT2>
.By that, you tell the system
MyClass<Float32, Boolean>
somewhere, it is clear which type parameter is replaced by which type argument.This proposal tries to not reinvent everything:
This proposal is not about optional explicit type parameters on
For now, we want to tackle the problems on type definitions. Let's see if we then still need those other forms of expression.