aboutsummaryrefslogtreecommitdiff
path: root/docs/notes/todo_keyword.txt
blob: 738eafc4c88d73a19df25bce47cf28e2c5718335 (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

todo expression
---------------
Behaves like the "undefined" value. Optionally prints an error message
and/or terminates the program (depending on which command line options
were given to the compiler) when the keyword is used in an expression.

    int i;
    i = todo; // error at runtime! "assigns" undefined to i
    
    i.print(); // error and/or prints garbage (i has an undefined value)

The todo expression can be used as a statement, like this:

    () f(bool x, bool y) {
        if (x) todo; // error at runtime!
        
        if (y) {
            "y is true".print()
            todo; // error at runtime!
        }
    }
    
    () g() {
        todo; // error at runtime!
    }


todo in loops
-------------

    for (int i in todo) { // error at runtime! behaves like []
        i.print();  // not executed
    }


todo types
----------
Behaves like a private / undefined type.

    typedef A = todo;