Using ocaml-top for teaching an introduction to OCaml class


I’ve been teaching an introduction to OCaml for several years, and I’ve always had some push-back from students about using emacs + tuareg (the first lab session was often an introduction to emacs…)

I’m considering switching to ocaml-top, as this course only uses the top-level. Are there others who use ocaml-top in a teaching environment? And is ocaml-top still maintained (I looked at the github issues and I’m not seeing much activity)?




Last commit to ocaml-top was only a couple of months ago. It might need a little kicking to work on 4.07 but I’m sure it would be trivial.

I’ve had students push back against the use of Emacs in several contexts. My usual attitude is, “you’re CS students, that means you’re going to have to deal with professional tools at some point”, but I get finding that exhausting. That said, I still make fun of students who use Notepad to write programs.


I recommend taking a look at visual studio code. It’s a pretty, cross-platform editor with pretty good support for OCaml.


Just to add onto other answers, I definitely don’t think emacs is a very good option if it’s new CS students, the learning curve is quite high, and it’s not very ergonomic by default. The default bindings almost wore my left pinky out, as in seriously hurt/suffered from inflammation, switched to spacemacs afterwards.

I think what @Yaron_Minsky suggested is the best option for students for their fingers’ health and better focus on OCaml.


Something was probably wrong with how you were using your keyboard. For example, you probably didn’t use the control and alt keys on both sides. Anyway, I started using emacs 35 years ago or so, and my pinkies are still firmly attached to my hands. I was taught how to use it in my intro class, btw, and it was fine.

I’ve taught freshmen to use emacs, and it turns out that it’s a lot easier than learning how to program so the added difficulty isn’t particularly high. But, again, your milage may vary. Editor choice is a pretty personal thing.

Anyway, if @brab prefers, ocaml-top is probably a fine choice if necessary.


Welp, my own fault then. Pressing space is still probably faster than pressing ctrl/alt on right side for me, so not too much of a loss for me.

Hm… yep your claims might be more reliable as I don’t have stats/experience to back anything up since my uni never taught any editor.


Editor taste like taste in most things is not really something you can call someone wrong for. (Except if they’re using Notepad or something like that, which is sort of pathetic.)

I tend to tell people to learn either Emacs or vi/vim because both have been in continuous use for decades and both are open source, so if you learn them well, your investment will likely pay off for many decades to come. But, Everyone’s Taste Differs.


I was just referring to my misuse of ctrl, where I only used left ctrl key. Using the right ctrl key never crossed my mind during that time for some reason.

Though emacs pinky seems to be quite common, so maybe it’s a somewhat common mistake.


I also find it’s important to sometimes use ESC instead of the meta key when hitting a ctrl-meta combination. Otherwise the finger combinations can get a little unpleasant. But yah, when using any system like emacs that requires a lot of multiple-finger operations on a keyboard, it’s important to pay attention to your hands. That said, I’ve done pretty well on hand comfort.


Thanks a lot for all the replies.

@Yaron_Minsky: I prefer to use and recommend free software, and I don’t think Visual Studio Code can work as a toplevel.


@brab Visual Studio Code is free software (MIT) and runs under Linux. Indeed it’s more of a text editor (with merlin integration) than an interactive toplevel, but it is a pretty good one from what I’ve heard.


Thank you for the correction, I knew it was open source, but I did not know it was free software.


ocaml-top is designed to be as simple as possible, but do exactly the job for lab sessions on the toplevel, with the basic editing functions anyone would expect ; it hasn’t seen much changes recently, but should still work fine. The Windows binaries are quite old though, and may need rebuilding for newer OCamls and fixes… I haven’t seen any requests for this and have been procrastinating, but it can definitely be done.

Note that it relies on the ocaml binary and doesn’t embed its own toplevel.

On a different, but related scope, we are working on a purely in-browser version derived from the OCaml MOOC platform. There is a preliminary version at, and we could imagine something like the “Exercises” screen, but with a blank exercise and just the toplevel.