4949 - [ 11.1 Pointwise Mixins] [ d5d3 ]
5050 - [ 11.2 Pointwise API] [ 2fcf ]
5151 - [ 11.3 Mixins Examples] [ 4938 ]
52+ - [ 11.4 Metadata Mixin] [ 9300 ]
53+ - [ 11.4.1 Performance] [ 455b ]
5254- [ 12 Geb Utilities] [ 4ffa ]
5355 - [ 12.1 Accessors] [ cc51 ]
5456- [ 13 Testing] [ 9bcb ]
@@ -59,13 +61,19 @@ Welcome to the GEB project.
5961<a id =" x-28GEB-DOCS-2FDOCS-3A-40LINKS-20MGL-PAX-3ASECTION-29 " ></a >
6062## 1 Links
6163
64+
65+
6266Here is the [ official repository] ( https://github.com/anoma/geb/ )
6367
6468and [ HTML documentation] ( https://anoma.github.io/geb/ ) for the latest version.
6569
70+
71+
6672<a id =" x-28GEB-DOCS-2FDOCS-3A-40COVERAGE-20MGL-PAX-3ASECTION-29 " ></a >
6773### 1.1 code coverage
6874
75+
76+
6977For test coverage it can be found at the following links:
7078
7179[ SBCL test coverage] ( ./tests/cover-index.html )
@@ -83,6 +91,8 @@ I recommend reading the CCL code coverage version, as it has proper tags.
8391
8492Currently they are manually generated, and thus for a more accurate assessment see [ ` GEB-TEST:CODE-COVERAGE ` ] [ 417f ]
8593
94+
95+
8696<a id =" x-28GEB-DOCS-2FDOCS-3A-40GETTING-STARTED-20MGL-PAX-3ASECTION-29 " ></a >
8797## 2 Getting Started
8898
@@ -344,6 +354,8 @@ conjectures about GEB
344354< a id = " x-28GEB-DOCS-2FDOCS-3A-40MODEL-20MGL-PAX-3ASECTION-29" ></ a>
345355## 5 Categorical Model
346356
357+
358+
347359Geb is organizing programming language concepts (and entities! ) using
348360[category theory](https:// plato. stanford. edu/ entries/ category- theory/ ),
349361originally developed by mathematicians,
@@ -411,31 +423,31 @@ In particular,
411423we shall rely on the following
412424universal constructions:
413425
414- 1 . The construction of binary products $ A × B $ of sets $ A ,B $ , and the empty product $\ mathsf{1 }$.
426+ 1 . The construction of binary products $ A × B $ of sets $ A ,B $ , and the empty product $ mathsf{1 }$.
415427
4164282 . The construction of “ function spaces” $ B ^ A $ of sets $ A ,B $ , called * exponentials* ,
417429 i. e. , collections of functions between pairs of sets.
418430
4194313 . The so- called [* currying* ](https:// en. wikipedia. org/ wiki/ Currying )
420432of functions,
421- $ C ^ {(B ^ A )} \ cong C ^ {(A × B )}$ ,
433+ $ C ^ {(B ^ A )} cong C ^ {(A × B )}$ ,
422434 such that providing several arguments to a function can done
423435 either simultaneously, or in sequence .
424436
4254374 . The construction of sums (a. k. a. co- products) $ A + B $ of sets $ A ,B $ ,
426438 corresponding to forming disjoint unions of sets;
427- the empty sum is $\ varnothing$.
439+ the empty sum is $ varnothing$.
428440
429441Product , sums and exponentials
430442are the (almost) complete tool chest for writing
431443polynomial expressions, e. g. ,
432- $$ Ax ^ {\ sf 2 } + x^ {\ sf 1 } - Dx ^ {\ sf 0 }.$$
444+ $$ Ax ^ {sf 2 } + x^ {sf 1 } - Dx ^ {sf 0 }.$$
433445(We need these later to define [“ algebraic data types” ](https:// en. wikipedia. org/ wiki/ Polynomial_functor_ (type_theory)). )
434446In the above expression,
435447we have sets instead of numbers/ constants
436- where $ \ mathsf{2 } = \ lbrace 1 , 2 \ rbrace$ ,
437- $ \ mathsf{1 } = \ lbrace 1 \ rbrace$ ,
438- $ \ mathsf{0 } = \ lbrace \ rbrace = \ varnothing$ ,
448+ where $ mathsf{2 } = lbrace 1 , 2 rbrace$ ,
449+ $ mathsf{1 } = lbrace 1 rbrace$ ,
450+ $ mathsf{0 } = lbrace rbrace = varnothing$ ,
439451and $ A $ and $ B $ are arbitrary (finite) sets.
440452We are only missing a counterpart for the * variable*!
441453Raising an arbitrary set to “ the power” of a constant set
@@ -458,6 +470,8 @@ Benjamin Pierce's
458470as it is very amenable * and *
459471covers the background we need in 60 short pages.
460472
473+
474+
461475< a id = " x-28GEB-DOCS-2FDOCS-3A-40MORPHISMS-20MGL-PAX-3ASECTION-29" ></ a>
462476### 5.1 Morphisms
463477
@@ -2010,6 +2024,90 @@ Let's see some example uses of [`POINTWISE-MIXIN`][445d]:
20102024```
20112025
20122026
2027+ <a id =" x-28GEB-2EMIXINS-3A-40METADATA-20MGL-PAX-3ASECTION-29 " ></a >
2028+ ### 11.4 Metadata Mixin
2029+
2030+ Metadata is a form of meta information about a particular
2031+ object. Having metadata about an object may be useful if the goal
2032+ requires annotating some data with type information, identification
2033+ information, or even various levels of compiler information. The
2034+ possibilities are endless and are a standard technique.
2035+
2036+ For this task we offer the [ ` META-MIXIN ` ] [ 4529 ] which will allow
2037+ metadata to be stored for any type that uses its service.
2038+
2039+ <a id =" x-28GEB-2EMIXINS-3AMETA-MIXIN-20CLASS-29 " ></a >
2040+ - [ class] ** META-MIXIN**
2041+
2042+ Use my service if you want to have metadata capabilities associated
2043+ with the given object. [ Performance] [ 455b ] covers my performance
2044+ characteristics
2045+
2046+ For working with the structure it is best to have operations to treat
2047+ it like an ordinary hashtable
2048+
2049+ <a id =" x-28GEB-2EMIXINS-3AMETA-INSERT-20FUNCTION-29 " ></a >
2050+ - [ function] ** META-INSERT** * OBJECT KEY VALUE &KEY WEAK*
2051+
2052+ Inserts a value into storage. If the key is a one time object, then
2053+ the insertion is considered to be volatile, which can be reclaimed
2054+ when no more references to the data exists.
2055+
2056+ If the data is however a constant like a string, then the insertion is
2057+ considered to be long lived and will always be accessible
2058+
2059+ The : weak keyword specifies if the pointer stored in the value is weak
2060+
2061+ <a id =" x-28GEB-2EMIXINS-3AMETA-LOOKUP-20FUNCTION-29 " ></a >
2062+ - [ function] ** META-LOOKUP** * OBJECT KEY*
2063+
2064+ Lookups the requested key in the metadata table of the object. We
2065+ look past weak pointers if they exist
2066+
2067+ <a id =" x-28GEB-2EMIXINS-3A-40MIXIN-PERFORMANCE-20MGL-PAX-3ASECTION-29 " ></a >
2068+ #### 11.4.1 Performance
2069+
2070+ The data stored is at the [ ` CLASS ` ] [ 7e58 ] level. So having your type take the
2071+ [ ` META-MIXIN ` ] [ 4529 ] does interfere with the cache.
2072+
2073+ Due to concerns about meta information being populated over time, the
2074+ table which it is stored with is in a
2075+ [ weak] ( http://www.lispworks.com/documentation/lcl50/aug/aug-141.html )
2076+ hashtable, so if the object that the metadata is about gets
2077+ deallocated, so does the metadata table.
2078+
2079+ The full layout can be observed from this interaction
2080+
2081+ ``` lisp
2082+ ;; any class that uses the service
2083+ (defparameter *x* (make-instance 'meta-mixin))
2084+
2085+ (meta-insert *x* :a 3)
2086+
2087+ (defparameter *y* (make-instance 'meta-mixin))
2088+
2089+ (meta-insert *y* :b 3)
2090+
2091+ (defparameter *z* (make-instance 'meta-mixin))
2092+
2093+ ;; where {} is a hashtable
2094+ {*x* {:a 3}
2095+ *y* {:b 3}}
2096+ ```
2097+
2098+ Since ` *z* ` does not interact with storage no overhead of storage is
2099+ had. Further if \` * x* goes out of scope, gc would reclaim the table leaving
2100+
2101+ ``` lisp
2102+ {*y* {:b 3}}
2103+ ```
2104+
2105+ for the hashtable.
2106+
2107+ Even the tables inside each object's map are weak, thus we can make
2108+ storage inside metadata be separated into volatile and stable
2109+ storage.
2110+
20132111<a id =" x-28GEB-2EUTILS-3A-40GEB-UTILS-MANUAL-20MGL-PAX-3ASECTION-29 " ></a >
20142112## 12 Geb Utilities
20152113
@@ -2266,6 +2364,8 @@ features and how to better lay out future tests
22662364 [42d7]: http://www.lispworks.com/documentation/HyperSpec/Body/m_defpkg.htm "DEFPACKAGE MGL-PAX:MACRO"
22672365 [43d2]: #x-28GEB-2EMAIN-3ACURRY-20GENERIC-FUNCTION-29 "GEB.MAIN:CURRY GENERIC-FUNCTION"
22682366 [445d]: #x-28GEB-2EMIXINS-3APOINTWISE-MIXIN-20CLASS-29 "GEB.MIXINS:POINTWISE-MIXIN CLASS"
2367+ [4529]: #x-28GEB-2EMIXINS-3AMETA-MIXIN-20CLASS-29 "GEB.MIXINS:META-MIXIN CLASS"
2368+ [455b]: #x-28GEB-2EMIXINS-3A-40MIXIN-PERFORMANCE-20MGL-PAX-3ASECTION-29 "Performance"
22692369 [4850]: http://www.lispworks.com/documentation/HyperSpec/Body/t_kwd.htm "KEYWORD TYPE"
22702370 [4938]: #x-28GEB-2EMIXINS-3A-40MIXIN-EXAMPLES-20MGL-PAX-3ASECTION-29 "Mixins Examples"
22712371 [49d4]: #x-28GEB-2EMAIN-3A-40GEB-UTILITY-20MGL-PAX-3ASECTION-29 "Utility"
@@ -2299,6 +2399,7 @@ features and how to better lay out future tests
22992399 [8fa5]: #x-28GEB-DOCS-2FDOCS-3A-40INSTALLATION-20MGL-PAX-3ASECTION-29 "installation"
23002400 [9162]: #x-28GEB-2EPOLY-2ESPEC-3ACOMPOSE-20TYPE-29 "GEB.POLY.SPEC:COMPOSE TYPE"
23012401 [925b]: #x-28GEB-DOCS-2FDOCS-3A-40POLY-SETS-20MGL-PAX-3ASECTION-29 "Poly in Sets"
2402+ [9300]: #x-28GEB-2EMIXINS-3A-40METADATA-20MGL-PAX-3ASECTION-29 "Metadata Mixin"
23022403 [94a8]: #x-28GEB-2EPOLY-3A-40POLY-MANUAL-20MGL-PAX-3ASECTION-29 "Polynomial Specification"
23032404 [96d0]: http://www.lispworks.com/documentation/HyperSpec/Body/f_equal.htm "EQUAL FUNCTION"
23042405 [97fb]: #x-28GEB-2ESPEC-3A-3CSUBSTMORPH-3E-20TYPE-29 "GEB.SPEC:<SUBSTMORPH> TYPE"
0 commit comments