add support for template/generic types #92
Replies: 4 comments
-
That is an interesting idea which needs some thought and investigation. The existing templates (list/set/map/optional) have corresponding mappings in all target languages: Other languages might not have an idea about user defined templates, so how should / could they be mapped? |
Beta Was this translation helpful? Give feedback.
-
According to wikipedia all the languages Djinni currently support has support for generic, and basically all the languages you might want to support right now also has support for them. But this also brings the more generic question of: do you want to limit more advanced features to be implemented if not supported by one language? maybe the feature set a user can use can depends on what language he is interested in (e.g. I am not interest in python, so why should python limit what djinni can do if I am not going to target this language?) A good example would be properties for example. I said we have a custom property type that we want to expose, but djinni could actually have support for properties built-in if we wanted to, as some languages provides such functionalities. But this is not the case for all languages by any means. Here you have 3 options:
|
Beta Was this translation helpful? Give feedback.
-
I convert that issue into a discussion, since I do not see a possible definition of done in a reasonable time. |
Beta Was this translation helpful? Give feedback.
-
@delaitre-manfrotto Using the additions here #113, its possible to implement a matching generic container on the ObjC side.
where using the type as so
would generate
If you have the full example of what you have created for one or two of the property_XXX that you have implemented I can determine how much of whay your doing manually can be |
Beta Was this translation helpful? Give feedback.
-
Right now one can have a
list<T>
,set<T>
oroptional<T>
but nothing else.It would be really useful to be able to define user specified generic types!
Right now the only solution is to duplicate the djinni API for each types...
e.g. we have a generic
property<T>
type in C++, but we have to expose it asproperty_i32
,property_float
,property_foo
,property_bar
... in djinni which is really annoyingBeta Was this translation helpful? Give feedback.
All reactions