diff options
-rw-r--r-- | research/oop.txt | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/research/oop.txt b/research/oop.txt new file mode 100644 index 0000000..a23546c --- /dev/null +++ b/research/oop.txt @@ -0,0 +1,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. |