

Ask HN: Safe languages available on all major platforms? - cottonseed

I&#x27;m thinking about an application that I&#x27;d like to deploy on all major platforms (OSX, Linux, Windows, iOS, Android).  My go to language is C++, but I&#x27;d like to use a type- and memory-safe language (goodbye, buffer overflows).  What are my realistic options?  Rust, golang and ocaml come to mind, although it doesn&#x27;t look like there is official ocaml support for iOS&#x2F;Android.  Any other good options I&#x27;m overlooking?  Any experience you can share?  How is integration with native libraries and services (e.g., UI, networking, file system)?  Thanks!
======
loumf
Haskell claims cross-compiler support for iOS and lists some ways to get it to
work on Android.

Probably be easier for the non-GUI parts. Networking and filesystem is
probably trivial. It doesn't sound like you need much access to the device
otherwise, but that would be something I would check before using -- they
probably do some kind of native-bridge.

------
ghuntley
.NET - if you're into OOP use C# and if functional is your thing use F#

Fantastic employment prospects, completely open source, runs on all desktop
and mobile platforms.

~~~
brudgers
I forgot about F# on Mono. It's probably a bigger leap from C++ though.

------
brudgers
C# via Mono using Xamarin tooling is realistic.

[https://xamarin.com/platform](https://xamarin.com/platform)

~~~
cottonseed
This looks like a good suggestion, but I'm planning to make parts of this free
software and it looks like the Xamarin platform is not.

~~~
brudgers
The Xamarin tooling isn't all free, but Miguel de Icaza [1] is a major figure
in open source. I'd be surprised if any Xamarin product necessitates closed
source.

Even if it did, helping to put food on his table would benefit the open source
community. There aren't many people about whom that can be said with less
doubt.

[https://en.m.wikipedia.org/wiki/Miguel_de_Icaza](https://en.m.wikipedia.org/wiki/Miguel_de_Icaza)

~~~
cottonseed
The free version of the Xamarin tools seem to have limited app size and
doesn't include their UI integration (Xamarin.Forms):

[https://store.xamarin.com/](https://store.xamarin.com/)

~~~
brudgers
I misunderstood. I thought your objective was to produce free as in speech and
beer software.

One reason cross platform tools often require payment is that Apple's terms
for the iOS app store require the use of Apple products for development. Part
of the cost goes to maintaining remote services on Macs to comply with those
terms.

The alternative for iOS development is to purchase, rent, or borrow a Mac and
develop in Objective-C, Swift, or JavaScript. That's probably less optimized
for type safety, cost, and cross platform deployment.

If you drop iOS, the JVM and Java is an alternative.

------
smt88
GUI, CLI, or both?

~~~
cottonseed
Both, although the core application could be CLI only, and the UI written
separately.

~~~
smt88
I honestly don't know of anything that fits your criteria. I know Go recently
got an iOS port, though. Rust is definitely too young. No idea about OCaml.

Unfortunately, the most portable language is JavaScript, and that isn't what
you're looking for.

~~~
ghuntley
.NET fits his entire criteria. Memory safe, type safety, open source, runs on
all desktop and mobile platforms, available in either OOP (C#) or functional
(F#) and has fantastic tooling.

~~~
smt88
When you say .NET runs on all operating systems, are you referring to Xamarin?
If not, I'd be very curious what else is out there.

~~~
ghuntley
I'm referring to Mono; Xamarin = targeting of iOS/Android via commercial
license.

.NET is now licensed under MIT and is being developed out in the open by
Microsoft on GitHub. vNext (5.0) is being concurrently developed/tested on
linux (mono), osx (mono) and windows.
[https://github.com/aspnet/home](https://github.com/aspnet/home) which also
means the platform is being unshackled from IIS via project OWIN
([http://whereslou.com/2014/06/10/asp-net-vnext-moving-
parts-o...](http://whereslou.com/2014/06/10/asp-net-vnext-moving-parts-owin/))
and the SDK is no longer a system wide installation, instead it ships with
your application
([https://github.com/aspnet/XRE](https://github.com/aspnet/XRE)) which enables
.NET to be dockerized. Visual Studio is no longer required (it's preferred)
but there are other options ->
[http://www.omnisharp.net/](http://www.omnisharp.net/)

Check out
[http://www.hanselman.com/blog/IntroducingASPNETVNext.aspx](http://www.hanselman.com/blog/IntroducingASPNETVNext.aspx)
for a overview.

