Describe the bug
jsoo's implementation of caml_float_of_string doesn't match Stdlib's handling of whitespace: jsoo allows trailing whitespace while regular ocaml does not
OCaml version 4.14.0
Enter #help;; for help.
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
# float_of_string "3.14";;
- : float = 3.14
# float_of_string " 3.14";;
- : float = 3.14
# float_of_string "3. 14";;
Exception: Failure "float_of_string".
# float_of_string "3.14 ";;
Exception: Failure "float_of_string".
(tl;dr float_of_string "3.14 " fails in regular ocaml but not jsoo)
Expected behavior
Trailing whitespace passed to float_of_string would raise an exception.
Describe the bug jsoo's implementation of
caml_float_of_string
doesn't match Stdlib's handling of whitespace: jsoo allows trailing whitespace while regular ocaml does notjsoo toplevel:
ocaml toplevel:
(tl;dr
float_of_string "3.14 "
fails in regular ocaml but not jsoo)Expected behavior Trailing whitespace passed to
float_of_string
would raise an exception.Versions ocamlc 4.14 jsoo 5.4.0
(NOTE: this is an extremely low-priority bug, but wanted to flag it because we stumbled across it in semgrep.js: https://github.com/returntocorp/semgrep/pull/8902/files#diff-e2f964d2fdf546821a6fcd6c642efc8e962a8972a1731b8196d36ef2e0aa621dR44-R47)