You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is also easier from a maintenance and development perspective that the accessors be consistent across bindings exported.
With a JSON counterpart also coming for Native Messaging (XapaJIaMnu/translateLocally#93), it is important to make the access consistent across Python, C++ and JavaScript, which the developers use.
WebAssembly is also, just bindings. However, WebAssembly appears to planted methods some of which are dead code as of now, creating another means to access the same thing.
This issue proposes to deprecate the WebAssembly added extra functions and constructing bindings via composition to make access to source/target identical and consistent with usages elsewhere.
I am not aware of performance hits we will incur with the convenience mentioned above, but a consistent API expecting the platform (emscripten/WebAssembly) to fix the performance hits in future is what I propose we should still go for.
The text was updated successfully, but these errors were encountered:
The C++ API uses
Response
as data.source
andtarget
are symmetric in structure and this has benefits.Python bindings almost entirely rely on pybind11 metaprogramming and composition to obtain an easy to maintain, binding friendly value-type.
bergamot-translator/bindings/python/bergamot.cpp
Lines 166 to 170 in a94725b
It is also easier from a maintenance and development perspective that the accessors be consistent across bindings exported.
With a JSON counterpart also coming for Native Messaging (XapaJIaMnu/translateLocally#93), it is important to make the access consistent across Python, C++ and JavaScript, which the developers use.
WebAssembly is also, just bindings. However, WebAssembly appears to planted methods some of which are dead code as of now, creating another means to access the same thing.
bergamot-translator/src/translator/response.h
Lines 65 to 75 in a94725b
bergamot-translator/wasm/bindings/response_bindings.cpp
Lines 25 to 33 in a94725b
This issue proposes to deprecate the WebAssembly added extra functions and constructing bindings via composition to make access to source/target identical and consistent with usages elsewhere.
The changes proposed in this issue will break the WebAssembly test page, but can be fixed quite easily. Also some stuff at https://github.com/mozilla/firefox-translations/blob/6892ad64164787adf1e284141cbd0d10e71fb40d/extension/controller/translation/translationWorker.js at some point, but assuming worker draws from test-page it's solved already by fixing the test-page. It is easier to incur the cost now than later and have all exports of at least
Response
evolve together.I am not aware of performance hits we will incur with the convenience mentioned above, but a consistent API expecting the platform (emscripten/WebAssembly) to fix the performance hits in future is what I propose we should still go for.
The text was updated successfully, but these errors were encountered: