Parties Who Own ScriptsΒΆ
There are three parties of people who own DkCoder scripts:
- You (the first party)
- Us (the second party)
- Them (the third parties)
Here is a handy reference table that summarizes the distinctions. You won't understand the table right now and that is OK. We'll cover "Us" and "Them" in later sections in a future edition of DkCoder, but it is nice to have all the information in one place. All you need to remember is if you have a question about parties, this is the table to check.
Party | Code Generators | Terms | Compiled Initially |
---|---|---|---|
You | DuneIde (default), Dune | Checked | Yes |
Us | Dune | No | |
Them | DuneIde (default), Dune | Checked | No |
In this section we'll talk about where your You scripts go.
Your scripts must be placed in specific paths. Here is an example which you've seen in the Quick Walkthrough, and the general pattern you must follow:
.
βββ src/
βββ DkHelloScript_Std/
β βββ Example001.ml
βββ <Libraryowner><Project>_<Unit>/
βββ <Modulename1>.ml
βββ <Modulename2>/
βββ <Modulename3>.ml
βββ <Modulename3>.mli
βββ <Modulename4>/
βββ <Modulename5>.ml
In the example above the DkHelloScript_Std
is a library. A library is an organization of files and directories. These directories can have subdirectories, and those subdirectories can have their own subdirectories (etc.).
Any directory under src/
that is named in the format:
<Libraryowner><Project>_<Unit>
is also a library.
Component | Part | Why |
---|---|---|
Dk | Library owner | A short identifier for which party owns the source code |
HelloScript | Project | Conventionally this is a name related to your source code repository, but it can be any organizational name you want. You might, for example, want to name it your product name. |
Std | Unit | Conventionally if you want to create a single library in a project, you use the name Std . Once you get too much code in your project, you can use the Unit to separate your code into more manageable, smaller pieces. |
We'll define the exact format of <Libraryowner>
, <Project>
, and <Unit>
below.
You can place your script into the library directory, or into a subdirectory (or subdirectory of a subdirectory, etc.) named according to the <Modulename>/
format defined below, as long as your script is named according to the <Modulename>.ml
format. There is also an optional <Modulename>.mli
script interface which is not covered in this article.
Part | Examples | Rules |
---|---|---|
Library owner | Dk , Acme , Blue123 | The Library owner must start with an ASCII capital letter and have a lowercase ASCII second letter; the remaining characters (if any) must be lowercase ASCII letters and/or ASCII digits.</td> |
Project | X , Ab , Widgets , WidgetsPlus | The Project must start with an ASCII capital letter. The remaining characters (if any) must be ASCII letters (any case) and/or ASCII digits. Conventionally you use something similar to your source code repository name as the Project.</td> |
Unit | Std , V1 , X | The library unit must start with an ASCII capital letter. The remaining characters (if any) must be ASCII letters (any case) and/or ASCII digits and/or underscores (_ ). Conventially the main unit for your project is named Std . Once you get too much code in your project, you can use the Unit to separate your code into more manageable, smaller pieces.</td> |
Examples | Counter Examples | Rule |
---|---|---|
Acme , Acme_Two , X | DkHelloScript_Std | The module name MUST NOT be a valid <Libraryowner><Project>_<Unit> name. |
Acme , Acme*Two , X | 12345 , someThing | The module name must start with an ASCII capital letter. The remaining characters (if any) must be ASCII letters (any case) and/or ASCII digits and/or underscores (* ). |