Quantcast
Channel: OCaml - Topics tagged dune
Viewing all articles
Browse latest Browse all 521

Newbie dune question

$
0
0

I’m trying to learn dune, and am finding that there’s a lot to learn. Can someone explain to me, or point me to the relevant dune docs, why it works this way:

Here’s what I have done:

  1. Created a new dune project: dune int proj test
  2. Changed the dune files in bin and lib to say “(libraries lib)” and “(name lib)”, respectively. (Because it makes more sense to me this way.)

I then tried 2 things. The first:

I created a file in lib called lib.ml, and put a function (func) there. In bin/main.ml, I “open Lib”, and the function is callable without having to use the filename, like:
let x = func 1 2

Then I changed the name of lib.ml to new.ml. Now, the function has to be called liek this:
let x = New.func 1 2

It seems odd to me that the rule is “If the filename matches the library name, you don’t have to code it. Otherwise, you do.”

Please tell me, or point me to docs about why this makes sense.

6 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 521

Trending Articles