How to constraint types for generics?

I have an Interface and I need to constrain all Obj to T1 and all Results to T2 (or something like this). How to?

you can do this by connecting the pins to any generic node that will have the same type on the inputs or outputs. for example with the ConstrainTypes node…

@tonfilm
now it looks like this:

изображение

изображение

seems like I’m doing something wrong

Is it right way?

that looks good, but I think generic interfaces are not yet fully supported… let us know how it goes.

1 Like

It goes badly) totally shuffled
got it, I’ll do this without generics
thanks!

We are currently working on a more explicit approach of working with type parameters. We’ll let you know as soon as there is a preview available for testing.
Here is more background information on that topic: https://github.com/vvvv/VL-Language/issues/39

2 Likes

I think it’s related
feels like a buggy bug, it’s totally silent

QuadTreeTest.vl (14.9 KB)

In the newest preview builds You now can use explicit type parameters.
Declare IBounds like so: IBounds<TMatter, TSpace>. Inside the patch, you now can annotate these explicitly introduced type parameters on the pins.

Note that no other type parameter is allowed any longer. When you go for explicit type parameters only those are valid. So when transitioning from implicit type parameter patches to explicit type parameter patches you will temporarily experience that parts of the patch get unused until you placed the mentioned type annotations.

Hoping that this helps

2 Likes

Regarding the QuadTree bug: I think it’s not related. I think the used library Auios.QuadTree depends on .Net Core instead of .Net Framework. I guess the idea of the algorithm doesn’t come with this restriction, so maybe you could build a .Net Framework library project and compile it yourself.


Sorrily this exception pops up at a pretty random place, not in your user code. That’s why it is tricky to show you the error at the right place. We’ll try to come up with a better eror report for exceptions like this.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.