SublimeREPL
SublimeREPL copied to clipboard
OCaml utop freezed upon decimal entry.
I am going through the "Real World OCaml: Functional Programing for the Masses" book. I have set up utop to run in Sublime Text 3 using SublimeREPL on a MacBook Pro OX 10.12.2 Sierra
I installed OCaml through Brew. Upon Startup of SublimeREPL -> OCaml -> utop I get:
Welcome to utop version 1.19.3 (using OCaml version 4.04.0)!
Findlib has been successfully loaded. Additional directives: #require "package";; to load a package #list;; to list the available packages #camlp4o;; to load camlp4 (standard syntax) #camlp4r;; to load camlp4 (revised syntax) #predicates "p,q,...";; to set these predicates Topfind.reset();; to force that packages will be reloaded #thread;; to enable threads
utop was built without camlp4 support.
If I enter the following:
open Core.Std;;
let another_tuple = ( 3, "four", 5.
It hangs upon entering the decimal point after 5
This does not happen when I go to utop via the terminal. And it does not happen when I use SublimeREPL OcCaml -> toplevel.
Any clues?
hi,
following Real World OCaml as well ;-) got stuck at:
let pi = acos(-1.)
in case anybody is still interested ... found a workaround ...
i'm using:
MacOS Mojava (10.14) oCaml: 4.06.1 utop:2.2.0 opam: 2.0.2 sublimetext 3.3.1, build 3176
i had to removed auto_complete_triggers settings where they are defined:
- SublimeText > Preferences > Settings:
"auto_complete_triggers":
[
{
"characters": "<",
"selector": "text.html"
},
{
"characters": ".",
"selector": "source.js"
},
{
"characters": "\\",
"selector": "text.tex.latex"
},
// {
// "characters": ".",
// "selector": "source.ocaml"
// }
],
- remove the lines that are commented out above (lines with //)
-
$HOME/Library/Application Support/Sublime Text 3/Packages/SublimeREPL/config/OCaml/OCaml\ (toplevel).sublime-settings
although this is really for OCaml's toplevel, decided to removed it as well...
{
// "auto_complete_triggers": [ {"selector": "source.ocaml", "characters": "."} ]
}
This obviously removes the code completion suggestions that would be triggered by the "." character, that is available in utop in terminals ... (if it had worked ...)
however, i usually disable code completions for my other REPL'ed languages, as the popup windows, obscure the code under the popups ... so no love lost ;-)
-
the terminal/utop code completion feature is nice ... it occupies just the [one] last row ...
-
I also had to reboot my system; very likely some errant entities were still talking-to/holding-on-to resources with the old config info...
As part of this bug hunt, i also:
A. amended the file: $HOME//Library/Application\ Support/Sublime\ Text\ 3/Packages/SublimeREPL/config/OCaml/Main.sublime-menu
a. replaced the values for the extend_env properties, with the outputs from the following command:
opam config env | egrep 'CAML_LD_LIBRARY_PATH|OCAML_TOPLEVEL_PATH'
did this for both the toplevel and utop sections.
b. set the cmd_postfix property to :";;\n" this automatically insert the required ";;" when typing code in REPL.
B. created and added the following lines into $HOME/.ocamlinit :
#use "topfind"
#require "core.top";;
open Core
-
to help follow the examples in 'Real World OCaml' ; Core.Std is deprecated.
-
just the bare minimum, as i don't yet understand what the rest are for.
-
watch out for messages that reports deprecations of submodules; best to change them now ...
Welcome to utop version 2.2.0 (using OCaml version 4.06.1)!
Findlib has been successfully loaded. Additional directives:
#require "package";; to load a package
#list;; to list the available packages
#camlp4o;; to load camlp4 (standard syntax)
#camlp4r;; to load camlp4 (revised syntax)
#predicates "p,q,...";; to set these predicates
Topfind.reset();; to force that packages will be reloaded
#thread;; to enable threads
# 1.0 /. 2.0;;
- : float = 0.5
#