aboutsummaryrefslogtreecommitdiff
path: root/notes/minimal_module.txt
blob: bff5351d20937509941ddfc70ff4814aa786318c (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

It would be nice if the "starting point" is really really small:

* No .index files (= application that uses only the stdlib and includes
  all .slul files)
* Minimal syntax for `giveme`s
    - have a "default initializer" (without `=`) for `giveme`s that gets
      the name of the variable and can use it, e.g. for an option name.
    - allow a literal default value.
* Minimal syntax for `entry`s
    - make identifier/name optional and default to `main`?
* Minimal syntax for code itself

For example:

    CommandMain "search"

    giveme
        # --input-file FILE (required)
        # TODO decide on syntax for modifiable/aliased/io types
        Reader@ input_file
        # --keyword STRING (required)
        String keyword
        # --stop-on-match (optional, default=false)
        bool stop_on_match = false
        # --case-insensitive false (optional, default=true)
        bool case_insensitive = true
        # --somestring STRING (optional, none by default)
        String? somestring
    end

    # `main` at top level is equivalent to
    #
    #   entry main
    #   code
    #       ...
    #   end
    main
        ...
    end

    # other options that were considered:

    # entry without name = `entry main`
    entry
    code
        ...
    end

    # without `entry` line = `entry main`
    code
        ...
    end