aboutsummaryrefslogtreecommitdiffhomepage
path: root/notes/builtin_common_funcs.txt
blob: 71c8df104760168680023020e98ff04901a1df20 (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

Builtin common functions
========================

Functions that are used by nearly every program, and very frequently,
could possibly be built-ins.

An example is logging:

    func var SomeType.do_stuff(int i)
    {
        debug "Starting. \={i}"
        if i < 0 {
            error "i may not be negative. \={i}"
            return
        }
        debug "Done"
        success    # code paths that go here may not have called "error"
    }

In this case, the "debug" calls would get wrapped by guard conditions
(or possibly even compiled out).

Should logging be allowed in functions that don't take any arena parameter?
    - If not, how should the log configuration be controlled?
      (and where should log output go?)
    - Perhaps there could be a special case for debug logging?
Related problem: Exceptions in arena-less functions?