topkg+ocamlbuild. Most of the packages that are missing
cmxs seem to be the custom
Makefile based system and some of the libraries distributed by OCaml.
So far I’m not using it in any practical way because I’m not able to load all of the libraries my code depends on! I want to use it for reasons similar to @n4323’s. I’m not using OCaml for statistical inference right now, but that is a good example. R’s repl is used a lot, I think, and some of the commercial statistical packages allow you to run analyses by making choices from drop-down menus, etc. I know one scientist who works that way exclusively.
I am writing population genetics models–abstract models of evolving populations of organisms. I want to know, what happens if I try the model with these parameters? What kind of output will I get? In general, the behavior of a population genetic model will be unlike what happens in a real evolving population if you set the population size to be small, so when you’re experimenting to see what the model does, population size should often be relatively large. With small population size, bytecode is fine, but with large population size, the difference between bytecode and native code is significant. Trying to experiment with an edit/compile/run-from-commandline process is very inconvenient. Among other things, you don’t end up with an output data structure that’s immediate available for inspection in a toplevel unless you do extra work, which seems kind of silly anyway. Why write a large number of floats to a file just so you can immediately read them into the toplevel? Once I have figured out what I want to do with a model, I sometimes decide to build it into a standalone executable, but I don’t want to do that when I’m trying to understand the implications of models I’ve constructed.
About @c-cube’s chicken-egg point, I’d go a little bit farther. It’s not just that existing OCaml users would use a native code toplevel if it worked well, but that this could be part of the appeal for new users. “You get type inference and fast native code in a well-tested functional language, and you get that even when you’re working in a repl, so you can easily do ad hoc experimentation with computationally intensive code.” So maybe there are people who would be more likely to have learned OCaml if there were a native toplevel that worked well and was publicized.
Based on packages I’ve noticed in the opam repository, it’s possible that the range of applications that have been the focus of the OCaml community tend to be ones that don’t benefit as much from from a repl. System tools, for example, probably should be conceived as standalone executable code from the start. That would be another reason that a native toplevel hasn’t seemed crucial to existing OCaml users. If so, then the fact that a native toplevel has seemed relatively unimportant to existing OCaml users might not be an indication of what would be important to potential new users. On the other hand, what’s in opam might not be representative of all of the things that people do with OCaml. (Your point, @gasche, that higher-order logic applications might benefit from a native toplevel makes sense to me, but I don’t do that kind of work.)
I have no idea if it’s related, but a native toplevel would also be useful for notebooks frontend (e.g. jupyter/ipython). That kind of interface, halfway between using an interactive toplevel and programming in a file, seems to be quite popular for data scientists in R or python. It could also be very useful to people doing the same in OCaml, or even (who knows?) for users of HOL-light or SMT solvers. Right now I’m working on a SMT solver written in OCaml and packaged as a collection of libraries; being able to interact with it in a flambda-enabled toplevel or notebook (without the horrible loss in performance imposed by bytecode) would be neat.
Can someone explain to me how ocamlnat works? In the bytecode toplevel, you’re running a fairly efficient state machine and pausing after every parsed command. When ocamlnat parses your command, how does it interpret it?