Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
[[tags: egg]] == coops-utils [[toc:]] == Documentation [[coops]] extensions. === Usage <enscript language=scheme> (import coops-utils) </enscript> === Argument Conventions {{INSTANCE}} is a {{coops-instance}}. {{SLOT}} is a {{symbol}}. {{INITFORM}} is {{'SLOT OBJECT}}. {{OBJECT}} is a Scheme {{object}}. {{CLASS}} is a coops {{class}}. {{GENERIC}} is a coops {{generic-procedure}}. {{METHOD}} is a coops {{generic-procedure}} {{method}}. Do not apply any but the supplied API to instances of this type! === Extras [[coops]] usage extensions. ==== Usage <enscript language=scheme> (import coops-extras) </enscript> ==== slot@ The slot accessor recursion. <syntax>(slot@ INSTANCE SLOT ...) --> *</syntax> Returns the slot value of the N'th named slot from {{INSTANCE}}. <syntax>(slot@ INSTANCE SLOT ... = OBJECT)</syntax> Sets the slot value of the N'th named slot of {{INSTANCE}} to {{OBJECT}}. Example: <enscript language=scheme> (import coops coops-extras) ;Needlessly complex for example (define-class <first> () (next)) (define-class <second> (<first>) ()) (define-class <third> (<second>) ()) (define 1st (make <first> 'next (make <second> 'next (make <third> 'next "the end")))) (slot@ 1st next next next) ;=> "the end" (slot@ 1st next next next = "still the end") (slot@ 1st next next next) ;=> "still the end" </enscript> (From '@' macro by Dan Muresan.) ==== make-copy <procedure>(make-copy INSTANCE [INITFORM ...]) -> coops-instance</procedure> Returns a copy of the object {{INSTANCE}}, except where an {{INITFORM}} overrides an existing {{SLOT}} value of the {{INSTANCE}}. The copy is a shallow copy that shares values with {{INSTANCE}}. {{make-copy}} is a {{generic-procedure}} specializing the first argument. === Describe [[coops]] object internals. ==== Usage <enscript language=scheme> (import coops-describe) </enscript> ==== describe-object <procedure>(describe-object INSTANCE [OUT (current-output-port)])</procedure> Prints information about the {{INSTANCE}} to the {{output-port}} {{OUT}}. {{describe-object}} is a {{generic-procedure}} specializing the first argument. A more detailed {{print-object}} for use in a ''REPL''. ==== describe-object-slot <procedure>(describe-object-slot INSTANCE SLOT [NAME-MAXLEN 32 [OUT (current-output-port)]])</procedure> Prints information about the {{INSTANCE}}'s {{SLOT}} to the {{output-port}} {{OUT}}. Does not append a {{(newline)}}. {{NAME-MAXLEN}} is the maximum number of single-width characters in a slotname. === Introspection [[coops]] predicates and read accessors. Some [[http://wiki.call-cc.org/eggref/4/tinyclos|TinyCLOS]] inspired property readers. ==== Usage <enscript language=scheme> (import coops-introspection) </enscript> ==== instance-of? <procedure>(instance-of? OBJECT CLASS) --> boolean</procedure> Is {{OBJECT}} an {{instance}} of the {{CLASS}}? ==== class? <procedure>(class? OBJECT) --> boolean</procedure> Is {{OBJECT}} an {{instance}} of the {{<standard-class>}}? <procedure>(check-class LOC OBJ [ARGNAM]) --> *</procedure> <procedure>(error-class LOC OBJ [ARGNAM])</procedure> ==== instance? <procedure>(instance? OBJECT) --> boolean</procedure> Is {{OBJECT}} an instance of a basic class. Neither an {{instance}} of the {{<standard-class>}} or a primitive such as {{boolean}} or {{vector}}? <procedure>(check-instance LOC OBJ [ARGNAM]) --> *</procedure> <procedure>(error-instance LOC OBJ [ARGNAM])</procedure> ==== primitive-instance? <procedure>(primitive-instance? OBJECT) --> boolean</procedure> Is {{OBJECT}} an {{instance}} of the {{<primitive-object>}} class or {{#t}}? '''Note''' {{#t}} is the default class, without the {{coops-primitive-objects}} module. ==== generic? <procedure>(generic? OBJECT) --> boolean</procedure> Synonym for {{generic-procedure?}}. <procedure>(check-generic LOC OBJ [ARGNAM]) --> *</procedure> <procedure>(error-generic LOC OBJ [ARGNAM])</procedure> ==== method? <procedure>(method? OBJECT) --> boolean</procedure> Is {{OBJECT}} a {{method}} of a {{generic-procedure}}? Only useful in the context of a {{generic-*-methods}} procedure result. <procedure>(check-method LOC OBJ [ARGNAM]) --> *</procedure> <procedure>(error-method LOC OBJ [ARGNAM])</procedure> ==== class-precedence-list <procedure>(class-precedence-list CLASS) --> (list-of class)</procedure> Returns the superclasses of {{CLASS}}. ==== class-slots <procedure>(class-slots CLASS) --> (list-of symbol)</procedure> Returns the slot names of {{CLASS}}. ==== class-direct-supers <procedure>(class-direct-supers CLASS) --> (list-of class)</procedure> Returns the uninherited superclasses of {{CLASS}}. ==== class-direct-slots <procedure>(class-direct-slots CLASS) --> (list-of symbol)</procedure> Returns the uninherited slot names of {{CLASS}}. ==== generic-anonymous? <procedure>(generic-anonymous? GENERIC) --> boolean</procedure> Is {{GENERIC}} an unnamed {{generic-procedure}}. ==== generic-name <procedure>(generic-name GENERIC) --> (union #f symbol)</procedure> Returns the name of {{GENERIC}}. The name is {{#f}} for an anonymous generic procedure. ==== generic-specialized-arguments <procedure>(generic-specialized-arguments GENERIC) --> (list-of symbol)</procedure> The arguments that {{GENERIC}} is specialized upon. ==== generic-primary-methods <procedure>(generic-primary-methods GENERIC) --> (list-of method)</procedure> Returns the list of {{#:primary}} methods for {{GENERIC}}. ==== generic-before-methods <procedure>(generic-before-methods GENERIC) --> (list-of method)</procedure> Returns the list of {{#:before}} methods for {{GENERIC}}. ==== generic-after-methods <procedure>(generic-after-methods GENERIC) --> (list-of method)</procedure> Returns the list of {{#:after}} methods for {{GENERIC}}. ==== generic-around-methods <procedure>(generic-around-methods GENERIC) --> (list-of method)</procedure> Returns the list of {{#:around}} methods for {{GENERIC}}. ==== method-specializers <procedure>(method-specializers METHOD) --> (list-of class)</procedure> Returns the classes that specialize {{METHOD}}. Throws an assertion error when slot not actually list. ==== method-procedure <procedure>(method-procedure METHOD) --> procedure</procedure> Returns the {{procedure}} for {{METHOD}}. Throws an assertion error when slot not actually procedure. == Examples <enscript language=scheme> (import coops coops-introspection) (define (print-methods generic) (for-each (lambda (m) (print (generic-name generic) " specialized by " (method-specializers m) " as " (method-procedure m))) (generic-primary-methods generic)) ) </enscript> == Requirements [[srfi 1]] [[srfi 13]] [[type-checks]] [[coops]] [[test]] [[test-utils]] == Bugs and Limitations * The introspection API is brittle, especially the generics portion. Suggested only for use during ''REPL'' development with [[coops]]. == Author [[/users/kon-lovett|Kon Lovett]] == Repository This egg is hosted on the CHICKEN Subversion repository: [[https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/coops-utils|https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/coops-utils]] If you want to check out the source code repository of this egg and you are not familiar with Subversion, see [[/egg-svn-checkout|this page]]. == Version history ; 2.3.0 : Depends on coops:1.4. Fix signatures. ; 2.2.4 : Stronger signatures. Fix closure access. ; 2.2.3 : Use format. ; 2.2.2 : Fix signatures, new test-runner. ; 2.2.1 : Use check-errors basic. ; 2.2.0 : {{make-copy}} is generic. ; 2.1.5 : Fix {{method?}}, {{instance?}} & {{primitive-instance?}}. ; 2.1.4 : {{make-copy}} uses ''fresh'' slots. ; 2.1.3 : Bug #1700. ; 2.1.2 : {{method-specializers}} & {{method-procedure}} type matches documentation. ; 2.1.1 : Fix signatures. ; 2.1.0 : {{describe}} in own module. ; 2.0.0 : CHICKEN 5 release. == License Copyright (C) 2010-2024 Kon Lovett. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 24 to 16?