blob: 97b9a5b3bc9f07ff89405d3a59a0a1d3aa271351 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
Submodules
==========
Use cases / advantages of submodules:
* Organizing large modules
* A basic form of encapsulation within a module
* Possibility of incremental compilation
* Possibility of faster compilation through parallelization
* Prevents refactorings from having unintentional cross-submodule effects
* Bundling/vendoring code
Also, the step between a submodule and a real module is farily small
--> Submodules can fairly easilly be broken out and become standalone modules
(as long as they don't depend on symbols from other submodules)
Perhaps something like this:
main.slul
\slul 0.0.0
\name somelib
\type library
\depends xyz 1.0
...
\submodule a
\submodule b
\source api_funcs.slul
func work(arena) -> int
api_funcs.slul
func work(arena) -> bool
{
return do_stuff_a(arena) and
do_stuff_b(arena)
}
# It's not very nice to have several files called "main.slul"
# (it makes it harder to search for them, and harder to identify
# tabs in editors etc.). So the "main" file of a submodule could
# perhaps be called <name>.slul instead.
# - Note: the main file may not include itself with \source!
a/a.slul
\slul 0.0.0
\name a
\type submodule
...
\source stuff.slul
func do_stuff(arena) -> bool
a/stuff.slul
func do_stuff(arena) -> bool
{
# ...
return true
}
Problems
--------
* Should it be possible to compile a submodule from the submodule directory?
If so, there has to be a way to locate the "top module".
* Should it be possible to have single-file modules, in addition to having
one directory per module?
* How to specifiy \depends on other submodules?
* Should it be possible to specify common dependencies in the "top module"?
Or version numbers only?
Or not at all?
Alternative solutions
---------------------
* Rely on bundling instead (see namespaces.txt).
i.e. have a directory called "subpkgs/" that contains the submodules
and that is configured as a bundled package repository.
|