summaryrefslogtreecommitdiff
path: root/bos-mop.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bos-mop.sh')
-rw-r--r--bos-mop.sh21
1 files changed, 11 insertions, 10 deletions
diff --git a/bos-mop.sh b/bos-mop.sh
index 1e69c47..b4eddc3 100644
--- a/bos-mop.sh
+++ b/bos-mop.sh
@@ -7,21 +7,21 @@ declare -a bos_5fbos_2fmop_2fbase_5fmro=( "bos/mop/base" )
# these are instance methods of the base metaclass
function bos/mop/base/mro-for-into() {
- bos-namespaces/store-array-for-into mro "$1" "$2"
+ bos-namespaces/store-array-for-into "$1" mro "$2"
}
# find the first class (in MRO) that defines a given method
function bos/mop/base/find-method-into() {
+ local -n bos_mop_base_find_method_result="$1"
# the class that started the method dispatch (the class of $self,
# usually)
- local class="$1"
+ local class="$2"
# what class invoked next/method (if we're doing next/method)
- local start_from_class="$2"
+ local start_from_class="$3"
# the method to look for
- local method="$3"
- local -n bos_mop_base_find_method_result="$4"
+ local method="$4"
- local mro_store; $self mro-for-into "$class" mro_store
+ local mro_store; $self mro-for-into mro_store "$class"
local -n mro="$mro_store"
# minimal MRO: the class itself
@@ -78,11 +78,12 @@ function bos/mop/base/invoke() {
# local; this is a probably-bad-but-works workaround: use a
# different variable name in different recursive calls
local ffsname="to_invoke_${#FUNCNAME[*]}"
- $self find-method-into "$class" "$start_from_class" "$method" "$ffsname"
+ $self find-method-into "$ffsname" "$class" "$start_from_class" "$method"
# TODO: make the fields accessible!
- bos-object-id/pack-self-into "$class" "$object_id" self
+ local self
+ bos-object-id/pack-self-into self "$class" "$object_id"
# call it
eval "\"\$$ffsname\" \"\$@\""
@@ -93,11 +94,11 @@ function bos/mop/base/create-object-into() {
local -n bos_mop_base_create_object_result="$1";shift
local class="$1";shift
- local object_id_store; bos-namespaces/store-scalar-for-into object_id "$class" object_id_store
+ local object_id_store; bos-namespaces/store-scalar-for-into object_id_store object_id "$class"
local -n object_id="$object_id_store"
(( ++object_id ))
- bos-object-id/pack-self-into "$class" "$object_id" bos_mop_base_create_object_result
+ bos-object-id/pack-self-into bos_mop_base_create_object_result "$class" "$object_id"
# TODO invoke BUILD/BUILDALL? probably in a different metaclass, though