aboutsummaryrefslogtreecommitdiff
path: root/notes/class_sections.txt
blob: a1c57de2e713b2b742810a273b967cb8c9aa1e6f (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120

Syntax for different sections of classes
========================================

Syntax test 1
-------------

Enum:

    only
        False
        True

Enum with record:
- enum values are always implicitly of the "specific" kind.

    only
        False = new 0 "false" "no"
        True  = new 1 "true"  "yes"

    record
        int     as_integer
        String  as_truefalse
        String  as_yesno

Value type:
- Or should it be called `value`? Because it could also be useful for
  serialization. And comparison and serialization could both be implemented by
  looping over run-time type information (RTTI)
- Do value types with modifiable fields really make sense?
  The data can always be copied over (with changes) to a new object.
  But on the other hand, it makes sense to do it in the same way as with
  other kinds of objects.

    record comparable
        String  name
        Int     count!

Object type:

    record specific
        Int fd

Parametric type:
- Should comparable/serializable/etc. typeparams be allowed?
- This form is quite limited. See also generics.txt and avoiding_builtins.txt

    typeparams
        comparable K
        V

    # or:
    #typeparam comparable K
    #typeparam V

    record comparable
        SomeClass K V  left
        SomeClass K V  right
        K  key
        V  value

Service implementation:
(Neither comparable or unique)

    CommandMain

    giveme
        String param = input_param

    record
        Int count! = 0

Interface file:

    class Bool
    only
        True
        False

    class Opaque

    class Point
    record comparable
        Int x
        Int y

    class Counter
    record identity
        Int count!

Keywords to use?
----------------

For records:

    record
    data
    (or just use the identity/no-identity qualifier)

For no-identity qualifier:

    comparable
    copiable
    value
    anonymous
    dozen
    noidentity
    nonidentified
    nonunique
    indefinite
    unspecific

For identity qualifier:

    identity
    identified
    unique
    definite
    referenced
    addressed
    specific