[ANN] down.0.2.0 and omod.0.4.0

It’s my pleasure to announce new releases for down and omod which provide a nice ocaml toplevel user experience upgrade. Simply add to your .ocamlinit:

#use "down.top"
#use "omod.top" 

And enjoy all the benefits you can learn about in the down manual and in the omod tutorial.

These are mainly maintenance releases but if you ever thought that down was a bit slow when pasting code, it now (well for almost two years…) implements bracketed pastes. Thanks to @emillon for the reference.

Daniel


A big thanks to my donators.

16 Likes

So many years of using Unix terminals, and I only learnt about bracketed pastes escapes today. Thanks for that, @dbuenzli and @emillon!

2 Likes

Just so I understand the intent better, is this an alternative to utop?

The feature sets do not fully overlap.

For example as far as I know there’s nothing like omod (load libraries by mentioning the module you want to use rather the rembering the library name where it resides) in utop. But IIRC you can use omod with utop, at least there some detection here.

The completion in down is likely too primitive for a heavy toplevel user (it relies on ocp-index and doesn’t understand opens) but it makes the bare ocaml toplevel usable (in a slightly better way than rlwrap would), especially if you care about a clean environment – utop setups a bunch of system things which makes it difficult to interactively test some system code. The exact impact of down on ocaml’s environment is described here, basically a signal handler for SIGWINCH and set raw mode on stdin when it prompts you.

So I would rather say that it makes ocaml usable rather than being an alternative to utop.

7 Likes

Thanks @dbuenzli for this nice lightweight improvement to the toplevel! Now if only someone had some spare time to make it work on Windows… :slight_smile:

Nicolas

First step would be to describe the problems. I see no Windows issue in any of the repos.

Another thing I forgot to mention is that both should work with ocamlnat . Not sure whether an utopnat exists.

There is one now :slight_smile: Down does not work on Windows · Issue #34 · dbuenzli/down · GitHub

Cheers,
Nicolas

1 Like

It seems[1] that this person was @nojb himself :–) Thanks to his work, release 0.3.0 is on its way to opam with Windows support. Thank you Nicolás!


  1. By now more works than his initial message seems to indicate there. ↩︎

6 Likes

Btw. @nojb now that we found out this nice ANSI compatibility mode for windows.

Isn’t there some material to upstream there for the stdlib channels and Unix.file_descr ? Something like:

Unix.set_ansi_capable : file_descr -> bool -> bool
Out_channel.set_ansi_capable : t -> bool -> bool   
In_channel.set_ansi_capable : t -> bool -> bool

This would be a nop on unices and do the magic on Windows ? I guess that would benefit quite a few tools out there starting with the compiler’s own colorful error messages and/or opam.

1 Like

Indeed, something like this could be useful. For the record, OPAM already is already using its own bindings (I guess the work of @dra27):

and the compiler has some special logic to be able to use colors under Cygwin caml_sys_isatty: detect Cygwin/MSYS for better -color heuristic by nojb · Pull Request #1406 · ocaml/ocaml · GitHub.

I think a first step is to have the compiler use the VT mode to emit colors under the native console cmd.exe as well (maybe replacing the special Cygwin logic along the way). Once that is working, we could then think about ways to expose this to users (it is always a bit complicated to argue for non-POSIX features in the standard library).

Cheers,
Nicolas

1 Like