Thanks for the insight. I guess translating the code that uses the very general "number" type might be a challenge too.

avindra goolcharan


On Thu, Jan 7, 2021 at 6:21 PM Aaron Puchert <aaronpuchert@alice-dsl.net> wrote:
Am 07.01.21 um 08:55 schrieb Avindra Goolcharan:
> js would be fine by me!
>
> More info I've gathered on hermes which is fairly new:
>
> The hermes engine itself has a connection with React Native. There is a
> section on this in the RN docs:
>
> https://reactnative.dev/docs/hermes <https://reactnative.dev/docs/hermes>
>
> More interesting than React however is that it uses an IR:
>
> https://hermesengine.dev/docs/ir <https://hermesengine.dev/docs/ir>
>
> The IR reminds me of llvm. I wonder how far off we are from building JS
> with clang ;)

Both are SSA-based, but this one seems to have optional types whereas in
LLVM types aren't optional. So this doesn't seem trivial to me, to put
it mildly. It's generally hard to compile dynamically typed (like
JavaScript) code into a statically typed language (like C++ or LLVM IR).
When you can't derive a static type you'll at least need a type switch
and in the worst case you'll have to look up symbols at runtime.

Also note that Clang is an (Objective-)C/C++ compiler frontend, so that
would certainly not be involved.

Best regards,
Aaron