summaryrefslogtreecommitdiff
path: root/bos-meta-bootstrap.sh
diff options
context:
space:
mode:
authorGianni Ceccarelli <gianni.ceccarelli@broadbean.com>2023-07-27 16:05:41 +0100
committerGianni Ceccarelli <gianni.ceccarelli@broadbean.com>2023-07-27 16:11:10 +0100
commit8e235105c5d98c4daa431c12f2136f89eaeb128d (patch)
tree744db4c3201035db243d5cf957ef6c24d643bc50 /bos-meta-bootstrap.sh
parentmore flexible namespaced stores (diff)
downloadbash-object-system-8e235105c5d98c4daa431c12f2136f89eaeb128d.tar.gz
bash-object-system-8e235105c5d98c4daa431c12f2136f89eaeb128d.tar.bz2
bash-object-system-8e235105c5d98c4daa431c12f2136f89eaeb128d.zip
vaguely bootstrap things?
Diffstat (limited to 'bos-meta-bootstrap.sh')
-rw-r--r--bos-meta-bootstrap.sh148
1 files changed, 148 insertions, 0 deletions
diff --git a/bos-meta-bootstrap.sh b/bos-meta-bootstrap.sh
new file mode 100644
index 0000000..f301812
--- /dev/null
+++ b/bos-meta-bootstrap.sh
@@ -0,0 +1,148 @@
+#!bash
+
+## metaclass instance for bos/meta/class itself
+
+declare bos_meta_class_meta_class_instance
+bos/meta/class/create-object-into bos_meta_class_meta_class_instance bos/meta/class
+bos-meta/set-metaclass-instance-for bos/meta/class "$bos_meta_class_meta_class_instance"
+
+$bos_meta_class_meta_class_instance make-mro-for bos/meta/class
+
+# metaclass instance for bos/meta/attribute
+
+declare bos_meta_attribute_meta_class_instance
+bos/meta/class/create-object-into bos_meta_attribute_meta_class_instance bos/meta/class
+bos-meta/set-metaclass-instance-for bos/meta/attribute "$bos_meta_attribute_meta_class_instance"
+
+$bos_meta_attribute_meta_class_instance make-mro-for bos/meta/attribute
+
+# here we create meta-attributes for the three attributes of
+# bos/meta/attribute: attribute_name attribute_type associated_class
+# and register them with the $bos_meta_attribute_meta_class_instance
+
+## we'll re-use this name
+declare bos_meta_attribute_instance
+
+## this is the `attribute_name` meta-attribute
+bos/meta/class/create-object-into bos_meta_attribute_instance bos/meta/attribute
+
+attribute_type='scalar'
+associated_class='bos/meta/attribute'
+
+attribute_name='attribute_name'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" attribute_name
+
+attribute_name='attribute_type'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" scalar
+
+attribute_name='associated_class'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" bos/meta/attribute
+
+$bos_meta_attribute_meta_class_instance set-attribute-by-name 'attribute_name' "$bos_meta_attribute_instance"
+
+## this is the `attribute_type` meta-attribute
+bos/meta/class/create-object-into bos_meta_attribute_instance bos/meta/attribute
+
+attribute_type='scalar'
+associated_class='bos/meta/attribute'
+
+attribute_name='attribute_name'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" attribute_type
+
+attribute_name='attribute_type'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" scalar
+
+attribute_name='associated_class'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" bos/meta/attribute
+
+$bos_meta_attribute_meta_class_instance set-attribute-by-name 'attribute_type' "$bos_meta_attribute_instance"
+
+## this is the `associated_class` meta-attribute
+bos/meta/class/create-object-into bos_meta_attribute_instance bos/meta/attribute
+
+attribute_type='scalar'
+associated_class='bos/meta/attribute'
+
+attribute_name='attribute_name'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" associated_class
+
+attribute_name='attribute_type'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" scalar
+
+attribute_name='associated_class'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" bos/meta/attribute
+
+$bos_meta_attribute_meta_class_instance set-attribute-by-name 'associated_class' "$bos_meta_attribute_instance"
+
+# now we set the attributes for bos/meta/class!
+
+## this is the `class-attributes` meta-attribute
+bos/meta/class/create-object-into bos_meta_attribute_instance bos/meta/attribute
+
+attribute_type='scalar'
+associated_class='bos/meta/class'
+
+attribute_name='attribute_name'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" 'class-attributes'
+
+attribute_name='attribute_type'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" assoc
+
+attribute_name='associated_class'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" bos/meta/class
+
+$bos_meta_class_meta_class_instance set-attribute-by-name 'class-attributes' "$bos_meta_attribute_instance"
+
+## this is the `class-name` meta-attribute
+bos/meta/class/create-object-into bos_meta_attribute_instance bos/meta/attribute
+
+attribute_type='scalar'
+associated_class='bos/meta/class'
+
+attribute_name='attribute_name'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" 'class-name'
+
+attribute_name='attribute_type'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" scalar
+
+attribute_name='associated_class'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" bos/meta/class
+
+$bos_meta_class_meta_class_instance set-attribute-by-name 'class-name' "$bos_meta_attribute_instance"
+
+## this is the `isa` meta-attribute
+bos/meta/class/create-object-into bos_meta_attribute_instance bos/meta/attribute
+
+attribute_type='scalar'
+associated_class='bos/meta/class'
+
+attribute_name='attribute_name'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" 'isa'
+
+attribute_name='attribute_type'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" arary
+
+attribute_name='associated_class'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" bos/meta/class
+
+$bos_meta_class_meta_class_instance set-attribute-by-name 'isa' "$bos_meta_attribute_instance"
+
+## this is the `mro` meta-attribute
+bos/meta/class/create-object-into bos_meta_attribute_instance bos/meta/attribute
+
+attribute_type='scalar'
+associated_class='bos/meta/class'
+
+attribute_name='attribute_name'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" 'mro'
+
+attribute_name='attribute_type'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" arary
+
+attribute_name='associated_class'
+$bos_meta_attribute_instance set-value "$bos_meta_attribute_instance" bos/meta/class
+
+$bos_meta_class_meta_class_instance set-attribute-by-name 'mro' "$bos_meta_attribute_instance"
+
+unset bos_meta_class_meta_class_instance bos_meta_attribute_instance attribute_name attribute_type associated_class
+