
OCamlEditor - edwintorok
http://ocamleditor.forge.ocamlcore.org/
======
rwmj
Anyone wants to work on real, used-in-production OCaml code, take a look at
the various libguestfs virt tools:

[https://github.com/libguestfs/libguestfs/tree/master/v2v](https://github.com/libguestfs/libguestfs/tree/master/v2v)

[https://github.com/libguestfs/libguestfs/tree/master/builder](https://github.com/libguestfs/libguestfs/tree/master/builder)

[https://github.com/libguestfs/libguestfs/tree/master/customi...](https://github.com/libguestfs/libguestfs/tree/master/customize)

[https://github.com/libguestfs/libguestfs/tree/master/resize](https://github.com/libguestfs/libguestfs/tree/master/resize)

[https://github.com/libguestfs/libguestfs/tree/master/sparsif...](https://github.com/libguestfs/libguestfs/tree/master/sparsify)

[https://github.com/libguestfs/libguestfs/tree/master/sysprep](https://github.com/libguestfs/libguestfs/tree/master/sysprep)

One great no-nonsense feature of OCaml is that you can just link programs
directly to C code, include a tiny C wrapper, and call straight into C with
virtually no overhead (literally no overhead for functions that don't need to
allocate on the OCaml heap).

------
StevePerkins
[meta]

Nothing at all against OCaml, but it puzzles me where these HN micro-fads
_come from_. There have inexplicably been a surge in OCaml posts on the front
page over the past week.

Which is perfectly fine, except that I haven't gotten around yet to learning
Rust (i.e. last month's fad). I'm still busy digging into Go (i.e. the fad
from six months ago), having grown bored with Scala (i.e. ancient history, at
least a year or two).

It is always exciting to see the fad spotlight shine on a mature language,
since reaching production-ready status is usually the point at which languages
stop being cool. However, the Haskell surge also rolls back around every few
months, and they seem to think that OCaml isn't "pure" enough. So what to do?

Are these short-lived bubbles the result of coordinated HN ranking
manipulation, or do brief convergences of interest just spontaneously bubble
up by coincidence?

[/meta]

~~~
tomp
I don't think OCaml is a fad. It's a great language, probably my favorite, but
it has so many problems that most people don't/can't/won't use it for any kind
of real-world problems.

To list just the main problems:

\- f*-up licence (open-source, but modifications can only be distributed as
source-code patches)

\- non-concurrent runtime (because the original developers don't care about
it)

\- ambiguous syntax which masks bugs

\- inconsistent and incomplete standard library (there are replacements, but
they too suck)

\- shitty REPL (at least on Windows)

Well, that's about it. It's really fast, safe, expressive, as functional as it
gets ([EDIT] also: compiled). Definitely one of the better-designed languages,
and a great starting point for many other languages (F#, Swift, Rust).

Lately, there has been a lot interesting development that eased development in
OCaml (basic overloading, this IDE), and more seems to be coming (concurrent
GC/runtime).

~~~
toolslive
This caught my attention...

\- ambiguous syntax: care to give a few examples?

\- inconsistent & incomplete standard library: the library that comes with the
compiler is basically the library of the compiler. Opam probably has
everything you need.

\- shitty REPL. use utop or use emacs. Anyway, I do think people on windows
are better of using F#. But that's another discussion.

~~~
tomp
This is an nice example I put together about the ambiguous syntax:

    
    
      if a > 0 then
        print_endline "a > 0" ;
        match a with
          | 0 -> print_endline "impossible"
          | 2 ->
            match b with
              | 0 -> print_endline "2, 0"
              | _ -> print_endline "2, not 0"
          | 3 -> print_endline "3, something"
          | _ -> print_endline "something, something"
      ;
      print_endline "done"
    

You can see the rest of the discussion here:
[https://news.ycombinator.com/item?id=8497740](https://news.ycombinator.com/item?id=8497740)

OPAM saves lives, that's true, but one still wishes there was a nice library
of standard data structures; I use Batteries, which inherit the inconsistency
of the standard library (for the sake of compatibility), the other real
alternative is Core, which is undocumented.

~~~
mercurial
I agree about the standard data structures, but there is no getting around the
fact that it's not going to happen. You could have a look at Containers[1] if
you want a break from Batteries.

1: [https://github.com/c-cube/ocaml-
containers](https://github.com/c-cube/ocaml-containers)

------
kev6168
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.

~~~
martijn_himself
I 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
That 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
You 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.

------
goraci
I wish i could try this editor but had no luck compiling it. Some troubles
with deps (lablgtk) and then infinite compile cycle issue i could not resolve.
Would be nice to have deps included in install script or something.

~~~
edwintorok
Usually it is a lot easier to try out OCaml applications using OPAM than
building by hand, if your platform has OPAM available.

What OS/distribution are you using? Also what compiler version, apparently it
requires OCaml = 4.01: [https://github.com/ocaml/opam-
repository/pull/537#issuecomme...](https://github.com/ocaml/opam-
repository/pull/537#issuecomment-23628104)

~~~
goraci
Ubuntu 14.04. I used opam to install lablgtk ( before that installed gtk+2.0 )
also installed xml-light with opam and then got infinite loop when compiling.
Ocaml 4+

~~~
edwintorok
Did you run this before building?: eval `opam config env` I tried this
Dockerfile and it succeeded, maybe compare your steps with the ones below. If
it still doesn't work try moving this discussion to stackoverflow or the OCaml
mailing list and provide the output when the infinite loop happens.

    
    
      FROM ubuntu:trusty
      RUN apt-get -y update && apt-get -y install opam aspcud && opam init -y
      RUN apt-get install -y m4 libexpat1-dev libgtk2.0-dev
      RUN opam install -y ocamleditor

~~~
goraci
"opam install -y ocamleditor" finally did the trick ) thanks

------
a0
Sincerely this project should be moved to GitHub and a milestone for
modernisation should be created (eg: port it to 4.02, add a plugin system to
ease integration with code analysis and build tools, etc).

Currently the only active developer (according to logs) is the original
creator of the project, while the project has potential to be maintained by
the community.

Add to it a native graphics support for OS X, a decent documentation and
suddenly you have a dream IDE.

~~~
edwintorok
It is on github too:
[https://github.com/ftovagliari/ocamleditor](https://github.com/ftovagliari/ocamleditor)

