cs3110 / textbook

The CS 3110 Textbook, "OCaml Programming: Correct + Efficient + Beautiful"
Other
720 stars 132 forks source link

Issue on page /chapters/basics/expressions.html #53

Closed alweiss282 closed 2 years ago

alweiss282 commented 2 years ago

In 2.2, it says that running dune build hello.exe will automatically create another dune-project. However, when I ran this command I received the following error: "Error: I cannot find the root of the current workspace/project. If you would like to create a new dune project, you can type: dune init project NAME Otherwise, please make sure to run dune inside an existing project or workspace. For more information about how dune identifies the root of the current workspace/project, please refer to https://dune.readthedocs.io/en/stable/usage.html#finding-the-root". Dune seemed to work correctly, when I manually created the project though (i.e. used dune init project NAME). Not sure if this is old syntax or something is wrong on my end?

jnfoster commented 2 years ago

It worked flawlessly for me...

[nate@jnf-cayuga:~> mkdir dunetest
[nate@jnf-cayuga:~> cd dunetest/
[nate@jnf-cayuga:~/dunetest> ls
[nate@jnf-cayuga:~/dunetest> cat > hello.ml
let () = ()
[nate@jnf-cayuga:~/dunetest> cat > dune
(executable
 (name hello))
[nate@jnf-cayuga:~/dunetest> dune build hello.exe
Info: Creating file dune-project with this contents:
| (lang dune 2.9)
[nate@jnf-cayuga:~/dunetest> ls
_build      dune        dune-project    hello.ml
[nate@jnf-cayuga:~/dunetest> 
alweiss282 commented 2 years ago

I believe that (as per dune's github) in dune 3.0 the automatic addition of dune-project may no longer occur (which explains why I have this issue while you do not, since it looks like you are running dune 2.9). Apologies if I am wrong, I am just trying to understand why following the textbook line-by-line didn't work for me.

clarksmr commented 2 years ago

Dune 3.0 appears to have been released 23 days ago. I can commit to updating the textbook (probably by omitting details, given how Dune is breaking my book!) the next time I teach the course, but mid-semester updates for this reason seem premature.

alweiss282 commented 2 years ago

I'm guessing that explains it! Thank you both for your patience/help.