summaryrefslogtreecommitdiff
path: root/bos-object-id.sh
diff options
context:
space:
mode:
authorGianni Ceccarelli <gianni.ceccarelli@broadbean.com>2023-07-14 16:36:10 +0100
committerGianni Ceccarelli <gianni.ceccarelli@broadbean.com>2023-07-14 16:36:10 +0100
commit86c37a00dd9ec82c261e3c9f7997051aabaa228b (patch)
treeb682b6e94d62e293aefa353008b33f85b57c6ed3 /bos-object-id.sh
parentsome sugaring (diff)
downloadbash-object-system-86c37a00dd9ec82c261e3c9f7997051aabaa228b.tar.gz
bash-object-system-86c37a00dd9ec82c261e3c9f7997051aabaa228b.tar.bz2
bash-object-system-86c37a00dd9ec82c261e3c9f7997051aabaa228b.zip
constructors & class methods!
"class methods" are not actually a thing, we declare a function for each class, that invokes on the class name and object-id=0 (object-id start from 1 for real objects)
Diffstat (limited to 'bos-object-id.sh')
-rw-r--r--bos-object-id.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/bos-object-id.sh b/bos-object-id.sh
index 2026506..ac7a7c8 100644
--- a/bos-object-id.sh
+++ b/bos-object-id.sh
@@ -7,17 +7,17 @@
# id, so that `$my_obj the-method 1 2` is equivalent to `bos_invoke
# TheClass $the_obj_id the-method 1 2`
function bos-object-id/pack-self-into() {
- local class="$1"
- local self_id="$2"
- local -n result="$3"
- result="bos-dispatch/invoke $class $self_id"
+ local bos_object_id_class="$1"
+ local bos_object_id_self_id="$2"
+ local -n bos_object_id_result="$3"
+ bos_object_id_result="bos-dispatch/invoke $bos_object_id_class $bos_object_id_self_id"
}
# get class and object id from a $self string
function bos-object/unpack-self-into() {
- local self="$1"
- local -n class="$2"
- local -n id="$2"
+ local bos_object_id_self="$1"
+ local -n bos_object_id_class="$2"
+ local -n bos_object_id_self_id="$3"
local _
- read -r _ class id <<<"$self"
+ read -r _ bos_object_id_class bos_object_id_self_id <<<"$bos_object_id_self"
}