Arch.Extended icon indicating copy to clipboard operation
Arch.Extended copied to clipboard

Attributes for generating query delegetes?

Open Shadowblitz16 opened this issue 2 years ago • 3 comments

Is it possible we can get a way to generate [n] number of generic delegates on our side?

For example a game engine might want to wrap 3rd party libraries and hand writing [n] number of signatures to simply wrap something is really awful.

This is kinda why C# needs variadic generics, and typedef but sadly it does not.

Shadowblitz16 avatar Oct 22 '23 04:10 Shadowblitz16

What exactly do you mean? Could you give samples? ^^

genaray avatar Oct 22 '23 17:10 genaray

like generating things like...


public delegate Query<T1> QueryDelegate<T1>();
public delegate Query<T1, T2> QueryDelegate<T1, T2>();
... n more times inside our own namespace.

In C++ if we wanted to forward things into our own engine namespaces we would just typedef it and statically link the library.

C# has no such feature so in order for me to write a wrapper or forward this api into my own namespace I would need to write a lot of boiler plate.

Shadowblitz16 avatar Oct 22 '23 23:10 Shadowblitz16

like generating things like...

public delegate Query<T1> QueryDelegate<T1>();
public delegate Query<T1, T2> QueryDelegate<T1, T2>();
... n more times inside our own namespace.

In C++ if we wanted to forward things into our own engine namespaces we would just typedef it and statically link the library.

C# has no such feature so in order for me to write a wrapper or forward this api into my own namespace I would need to write a lot of boiler plate.

Unfortunately that is not possible yet... you can however write your own source-generator to generate them ^^

genaray avatar Oct 25 '23 15:10 genaray