((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/describe-coops" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.")) (section 2 "describe-coops" (p "Display textual descriptions of built-in objects, user-created records, and coops objects.")) (section 2 "Overview" (p (tt "describe-coops") " provides the same API as " (tt "describe") " but additionally supports " (int-link "/egg/coops" "coops") " objects.") (p "The only API difference is the addition of a " (tt "describe-object") " generic procedure, with a useful default implementation for coops classes and objects.  If " (tt "coops-primitive-objects") " is loaded, you can specialize on primitive objects as well.")) (section 2 "Usage" (pre "(use describe-coops)") (p "There's no need to load " (tt "describe") ", as this egg loads " (tt "describe") " itself and exports a compatible API.  Loading " (tt "describe") " after " (tt "describe-coops") " will wipe out the REPL shortcuts.")) (section 2 "REPL" (p "The REPL shortcuts -- " (tt ",d") " and friends -- provided by the " (i "describe") " egg are extended to support coops objects.")) (section 2 "API" (def (sig (procedure "(describe obj #!optional out)" (id describe))) (p "Prints a textual description of " (tt "OBJ") " to output port " (tt "OUT") ", which defaults to " (tt "(current-output-port)") ".  For coops objects, this dispatches to " (tt "describe-object") "; otherwise it calls " (tt "describe") " from the " (int-link "/egg/describe" "describe egg") ".") (p "Note that this is not a generic procedure.")) (def (sig (procedure "(describe-object obj out)" (id describe-object))) (p "Generic procedure specialized on " (tt "OBJ") ", responsible for printing the textual description of " (tt "OBJ") ".  " (tt "describe") " calls this under the hood.") (pre "#;> (define-class <point> () (x y z))") (pre "#;> (describe <point>)\ncoops standard-class <point>\n  class precedence list: (<standard-object>)\n  slots: (x y z)") (pre "#;> (describe (make <point> 'x 1 'y 2 'z 3))\ncoops instance of class <point>:\n  x : 1\n  y : 2\n  z : 3") (pre "#;> (define-method (describe-object (obj <point>) out)\n      (fprintf out \"<point> object with coordinates (~A, ~A, ~A)~%\"\n       (slot-value obj 'x) (slot-value obj 'y) (slot-value obj 'z)))") (pre "#;> (describe (make <point> 'x 1 'y 2 'z 3))\n<point> object with coordinates (1, 2, 3)") (p "If " (tt "coops-primitive-objects") " is loaded, you can specialize on primitive objects such as fixnums; the default implementation prints both the object's class and the " (i "describe") " egg's description. For example:") (pre "#;> (describe 3)\nexact integer 3 (#x3 #o3 #b11 #\\x3)\n#;> (use coops-primitive-objects)\n#;> (describe 3)\ncoops instance of primitive class <fixnum>\nexact integer 3 (#x3 #o3 #b11 #\\x3)")) (def (sig (parameter "(describe-sequence-limit n)" (id describe-sequence-limit)) (procedure "(set-describer! tag proc)" (id set-describer!)) (procedure "(dump obj #!optional offset length out)" (id dump)) (procedure "(hexdump bv start end ref out)" (id hexdump))) (p "Same as their " (int-link "/egg/describe" "describe egg") " equivalents. They are exported for convenience, so " (tt "(use describe)") " is not required when using this egg.") (p "It's not currently possible to dump a coops object."))) (section 2 "Version history" (dl (dt "0.1") (dd "Initial release"))) (section 2 "Author" (p (int-link "/users/jim-ursetto" "Jim Ursetto") ", " (link "http://ursetto.com" "Ursetto Consulting, Inc.")) (p "Some code was taken from Kon Lovett's " (int-link "/egg/coops-utils" "coops-utils") " egg.")) (section 2 "License" (p (link "https://bitbucket.org/ursetto/describe-coops/raw/tip/LICENSE.txt" "MIT") ".")))