summaryrefslogtreecommitdiffstats
path: root/research/oop.txt
blob: a23546c462955b16b3d3d4aadde8111970a2a73a (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
Class member declarations
=========================

Public member declaration
-------------------------

Public static member declaration
--------------------------------

Private member declaration
--------------------------

Private static member declaration
---------------------------------

Object Member Access Operations
===============================

Lvalue Assignment
-----------------

Implementation:

    # High level
    array_set ${obj} mbr ${val}
    # Low level
    eval __arr_${obj}_mbr'=${val}'

Syntax:

    obj->mbr=${val}

Explanation:

`->` dereferences/expands `obj` and accesses the `mbr` lvalue, as in the
following (unsupported) syntax: `${obj}.mbr=${val}`.

Rvalue Expansion
----------------

Implementation:

    # High level
    array_get ${obj} mbr
    val=${retval}
    # Low level
    eval 'val=${'__arr_${obj}_mbr'}'

Syntax:

    val=${obj->mbr}

Explanation:

`->` dereferences/expands `obj` and accesses `mbr`, then `${...}` expands its
rvalue, as in the following (unsupported) syntax: `val=${${obj}.mbr}`.

Rvalue Call
-----------

Implementation:

    # High level
    array_get ${obj} mbr
    ${retval}
    # Low level
    eval "\${__arr_${obj}_mbr} ${obj}" 'arg'

Syntax:

    ${obj->mbr} arg

Explanation:

`->` dereferences/expands `obj` and accesses `mbr`, then `${...}` expands its
rvalue, as in the following (unsupported) syntax: `${${obj}.mbr}`.

Class Member Access Operations
==============================

Lvalue Assignment
-----------------

Implementation:

    # High level
    array_set Cls mbr ${val}
    # Low level
    eval __arr_Cls_mbr'=${val}'

Syntax:

    Cls::mbr=${val}

Explanation:

`::` accesses the `mbr` lvalue of `Cls`.

Rvalue Expansion
----------------

Implementation:

    # High level
    array_get ${Cls} mbr
    val=${retval}
    # Low level
    eval 'val=${'__arr_Cls_mbr'}'

Syntax:

    val=${Cls::mbr}

Explanation:

`::` accesses the `mbr` member of `Cls`, then `${...}` expands its rvalue.

Rvalue Call
-----------

Implementation:

    # High level
    array_get ${Cls} mbr
    ${retval}
    # Low level
    eval "\${__arr_Cls_mbr} Cls" 'arg'

Syntax:

    ${Cls::mbr}

Explanation:

`::` accesses the `mbr` member of `Cls`, then `${...}` expands its rvalue.