aboutsummaryrefslogtreecommitdiff
path: root/notes/noreturn.txt
blob: 9d906b597fb46199eb3ae6fa27a3b9f3aad79cc3 (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

noreturn functions
==================

Syntax 1:
+ short

    func f
        Int x
    noreturn
    code
        ...
    end


Syntax 2, special "NoReturn" type:
* Inspired by Python's type hints, but this would be a real type
* the "NoReturn" type can't be used elsewhere.
- one extra line

    func f
        Int x
    return
        NoReturn
    code
        ...
    end


Syntax 3, special "Never" type:
* Inspired by Python's type hints, but this would be a real type
- one extra line
- the "Never" type can't be used elsewhere, so it could be confusing.

    func f
        Int x
    return
        Never
    code
        ...
    end