diff options
Diffstat (limited to 'bos-sugar.sh')
-rw-r--r-- | bos-sugar.sh | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/bos-sugar.sh b/bos-sugar.sh index e211b5e..a199ed9 100644 --- a/bos-sugar.sh +++ b/bos-sugar.sh @@ -18,9 +18,9 @@ function bos-sugar/block() { declare -a bos_sugar_class_stack function bos-sugar/current-class-into() { - local -n result="$1" + local -n bos_sugar_current_class_result="$1" local IFS=/ - result="${bos_sugar_class_stack[*]}" + bos_sugar_current_class_result="${bos_sugar_class_stack[*]}" } function bos-sugar/set-metaclass-for-current-class() { @@ -47,12 +47,25 @@ function bos-sugar/class-open() { $metaclass_object set-superclasses-for "$fq_class" "$@" } + eval "function $fq_class { bos-dispatch/invoke \"$fq_class\" 0 \"\$@\"; }" + bos-namespaces/start "$fq_class" - return 0 -} + # this will get renamed into the class + function new-into() { + local class _; bos-object/unpack-self-into "$self" class _ + local -n new_into_result="$1"; shift + local metaclass_ref; bos-namespaces/store-scalar-for-into meta "$class" metaclass_ref + local -n metaclass_object="$metaclass_ref" + local new_object + $metaclass_object create-object-into new_object "$class" + new_into_result="$new_object" + } + + return 0 +} function bos-sugar/class-close() { local class="$1" |