skypjack skypjack - 10 months ago 95
C++ Question

Djinni: how to deal with wannabe overloaded methods?

I've recently used djinni in a medium sized mobile project.

It's really a useful tool that helped us easing and speeding up the development process.

More than once it would have been helpful overloading a method.

This is not possible in djinni (I guess it is due to the limitations of one of the targeted platforms) and we ended up with two methods having slightly different names.

Is this the suggested approach when one uses djinni?

There exist cleverer approaches to do that?

I find that having two methods with different names is a bit error-prone, but the documentation does not mention neither the (let me say) issue nor suggests a workaround for that.

Answer Source

You're right that Djinni doesn't support overloading, and that it's because of the limited support of some of the target language. Neither Objective-C nor Python support overloading (though C++ and Java do), and we decided it's better to have the Djinni method names be the same in all languages, rather than trying to auto-generate unique names for overloaded methods.
My recommendation would be to pick unique and memorable names yourself, like do_something_int(), or do_something_with_int() if you like the Objective-C style.
But another part of Djinni not trying to do this automatically is that we figure you can pick better names for your use case than Djinni can automatically.