5 ms·
OCaml and its ecosystem are becoming so enticing day by day I feel like I am running out of excuses not to dive in NOW :-) Obviously it's extremely powerful in
by kev6168 12y ago
OCaml and its ecosystem are becoming so enticing day by day I feel like I am running out of excuses not to dive in NOW :-)
Obviously it's extremely powerful in many different domains. But one particular area I am interested in is mobile app development. Google search shows OCaml indeed has libs/tools for writing and compiling apps. I am curious about what's the current status and experience in using OCaml in Android/iOS development.
- pjmlp 12y agoIt will be the same pain as C and C++, outside the blessed NDK APIs, which are only game development related, it is JNI pain. As for the compiler I think it can already cross-compile to Android.
- kev6168 12y ago>> As for the compiler I think it can already cross-compile to Android. That's great to know. Also, if taking the js/html5 route, maybe Js_of_ocaml can help to ease the pain? I've heard nothing but good things about it.
- edwintorok 12y agoThere are two android-related repositories (I haven't built any applications with them though): https://github.com/whitequark/opam-android https://github.com/whitequark/opam-android https://github.com/vouillon/opam-android-repository https://github.com/vouillon/opam-android-repository
- martijn_himself 12y agoI think one of the most realistic options would be to explore F# on Xamarin, if you are willing to pay the indie subscription fee (for Xamarin, that is). F# is a superset of OCaml (well maybe not very strictly speaking but practically for all intents and purposes). Xamarin is gaining a lot of traction as a platform for writing native apps that deploy to Android and iOS. Personally I have very good experiences with both the language and the platform, I would recommend you check it out.
- orbifold 12y agoThat is not entirely true, there is some overlap but also enough distinct features on the language level to make a difference. For example object oriented features in OCaml are quite different, OCaml has a more powerful module system (functors), it has open polymorphic variants, extensible syntax. F# has also a number of features that Ocaml hasn't, but it is definitely not true that one is the superset of the other. The runtime situation is arguably also a matter of preference, Ocaml compiles down to fairly efficient machine code and has a well tuned garbage collector, whereas F# at least initially had to rely on a garbage collector that was tuned for a different use case.
- martijn_himself 12y agoYou give a very clear overview of the differences between the languages and I agree it is important to stress that there are significant differences between the two. The OP mentions mobile development though and if the goal is to ship apps targeting iOS and Android, it is not going to be practical to use OCaml- hence my suggestion.
- kev6168 12y agoFor me F#'s syntax is so clean and pleasant to look at, I just love it. But having been in the JVM land for too long, at the beginning I like to get a bit more 'native' and learn OCaml. Hopefully acquired functional programming knowledge can be transferred to F#+Xamarin app development later.
- jallmann 12y agoJeffrey Scofield has a OCaml cross-compiler for iOS [1], and a number of of example apps are available, including ones using OpenGL ES. The bridges connecting OCaml to iOS UI components are incomplete, so you might have to do a bit of work to support certain components, but the work would be reusable. Not difficult if you follow the example apps, but maybe tedious. I think the effort is worth it for what OCaml gives you. [1] http://psellos.com/ocaml/compile-to-iphone.html http://psellos.com/ocaml/compile-to-iphone.html