Hacker News new | ask | show | jobs
by dpezely 2497 days ago
The overhead of C++ adoption actually prevented us from ever moving fully in this direction.

Today, unlike in 2013 when they started, there are other options.

For others considering code-sharing, another option not mentioned in their article is Rust for the core with Swift and Kotlin. Between bindgen, futures, serde_json and non-nullable pointers in Rust, those would satisfy their stated subcategories today.

Companion templates are explained here: (January 2019)

Medium.com/visly/rust-on-ios-39f799b3c1dd

Medium.com/visly/rust-on-android-19f34a2fb43

(No affiliation other than starting to proceed down this path myself.)

For Common Lisp heads, there's also MOCL, which seemed quite reasonable when I explored it years ago: wukix.com/mocl

2 comments

How does Rust differ significantly from C++, other than the fact that neither platform's toolchain can compile it out of the box?
I don't know enough details to say for sure, but some possibilities:

1. People may be more willing to learn Rust. I much prefer the language itself, but also it's clearly on the rise, so it may feel like a better learning investment.

2. The standard library is broader and the package ecosystem is easier to work with, so you might be able to have a more standard stack with fewer proprietary bits.

3. One complication with integrating multiple languages is making different memory management strategies coexist. Rust's type system seems to have ways of making that easier, e.g. neon-bindings.com

It is really easy to make a blunder in c++ that will require a lot of effort to find. Debugging that on mobile platforms is not fun. Like they mention a deadlocking issue that was difficult to solve.

Rust is built for memory and thread safety. Also the much better build system and open source ecosystem.

> Debugging that on mobile platforms is not fun

That's debatable ;)

Less foot guns. And it's not crazy in either env to have externally built libraries.
Its pretty evident from things they said in this blog post that they want to stay firmly in mainstream. They mentioned C/C++ is the only compiler supported by both platform vendors, which is important due to a "whole host of other issues" that they didn't specify. So using a compiler developed by a company that doesn't even sell commercial support would be a non-starter. Still there are commercially supported platforms that are quite mature at this point, such as Xamarin.