summaryrefslogtreecommitdiff
path: root/bos-object-id.sh
blob: 47dfd6d2806cfc6a5ce908b303121c7dde7feb34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!bash 
## object identity 
 
# objects are values, so they're stored in variables! 
# 
# the shape of that value is… a call to bos_invoke curry-ed on class and 
# 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 -n bos_object_id_result="$1"
    local bos_object_id_class="$2"
    local bos_object_id_self_id="$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 -n bos_object_id_class="$1"
    local -n bos_object_id_self_id="$2"
    local bos_object_id_self="$3"
    local _
    read -r _ bos_object_id_class bos_object_id_self_id <<<"$bos_object_id_self"
}