Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code example fails on Mac due to Core.Sys deprecation in favor of Sys_unix #3644

Open
OliverBalfour opened this issue Aug 3, 2022 · 1 comment

Comments

@OliverBalfour
Copy link

I was reading the Lists and Patterns chapter and tried the recursive directory listing example halfway down. However, opening utop and trying to invoke Core.Sys.is_file_exn came up with a deprecation warning:

utop # Core.Sys.is_file_exn;;
Line 1, characters 0-20:
Alert deprecated: Core.Sys.is_file_exn
[since 2021-04] Use [Sys_unix]
Line 1, characters 0-20:
Alert deprecated: Core.Sys.is_file_exn
[since 2021-04] Use [Sys_unix]
- : [ `Use_Sys_unix ] = `Use_Sys_unix

utop # Core.Sys.is_file_exn "file";;
Error: This expression has type [ `Use_Sys_unix ]
       This is not a function; it cannot be applied.

I fixed this by using

open Base;;
#require "core_unix.sys_unix";;
module Sys = Sys_unix;;
Sys.is_file_exn "file";;

Environment:

  • Apple Silicon Mac (2021 MBP)
  • Affected OCaml 4.13.1 and 4.14.0, both installed with opam per your install instructions
@nmarinic
Copy link

I can confirm this is happening in Core.Command as well. Copying the md5 example and attempting to build results in the following.

% dune build File "bin/main.ml", line 25, characters 9-20: 25 | let () = Command.run ~version:"1.0" ~build_info:"RWO" command ^^^^^^^^^^^ Error (alert deprecated): Core.Command.run [since 2021-03] Use [Command_unix] File "bin/main.ml", line 25, characters 9-20: 25 | let () = Command.run ~version:"1.0" ~build_info:"RWO" command ^^^^^^^^^^^ Error: This expression has type [Use_Command_unix ]
This is not a function; it cannot be applied.
'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants