Igalia / acacia

Library for inspecting accessibility APIs
https://igalia.github.io/acacia
GNU Lesser General Public License v2.1
8 stars 1 forks source link

Do we need different bindings definitions for each target language? #32

Open alice opened 10 months ago

alice commented 10 months ago

Python, JavaScript etc. have quite different conventions as to how things are named, whether things are properties or getter-methods etc. Do we want to explicitly have API definitions which are specific to each target language?

alice commented 10 months ago

Another example is toString() - Python has a system where you can call __repr__() or __str__() on an object and they'll return different stringified versions of the object for debugging. Javascript, conversely, heavily uses toString() both for debugging and for implicit string conversions (such as JSON.stringify()). Other languages have other types of toString conventions and APIs. It would be nice to support these natively without library users needing to write the same wrapper code each time.

elima commented 10 months ago

(Just my two cents)

Good question. While I see benefits in having an API that feels "native" to the language in question, I would stick to whatever SWIG produces based on our C++ API. And for the C++ API, I would use what makes more sense for C++.

Basically, I wouldn't worry too much about this for now and defer the problem to when we find an issue in one language, or we see that one particular language is important enough as to provide custom API for it (outside what SWIG provides).

alice commented 10 months ago

Yeah I think that's a good strategy for our v0 at least! Focusing on one language at a time will help keep things reasonably scoped, especially when there are so many other variables.

spectranaut commented 8 months ago

Alice brought this up in #105 and it got me thinking about it again, but I just came to Edu's conclusion. I would be a far amount of initial work to write extra interface files, and I want to start actually using the library for testing :)

spectranaut commented 7 months ago

Do we want in the python and node bindings an option to return a JSONifiable object or JSON object that represents the nodes -- with all the properties we can find on that object? We could use getters in javascript (do they have this in python?). This might be slightly more annoying to do in c++.