Generics is effectively a way to generate codes using templates at either compile time or runtime.
Being able to handle generics opens doors to greater possibilities and brings Divooka one step closer to linguistic parity with C#. At the moment the focus is mostly to directly import functions from the C# side, but in the future we may explore what this capability means to Divooka itself.
It's expected to work, but to actually see it work - even as a first draft, is still thrilling!
Complete Example
Generics Interface Illustration
Some Key Notes
- Methods can be generic themselves, or just contain parameters that happens to be generic - in the latter case it's derived from the type.
- A constructor is always the second case, and it's important from interface/syntax perspective to simplify the need to explicitly specifying argument types.
In Divooka, we expose functional generics as an additional runtime-parameter, this opens new doors to possibilities!
Top comments (3)
Seeing generics come to life in Divooka is exciting ..
This is extremely impressive, seeing generics pop up like this gives me the chills, honestly. Great work making Divooka feel more real
Thank you so much for the comments!
It's a very essential ingredient and there is still a lot of work to do to ensure everything works correctly!