Types, Classes and PropertiesProductClasses

Classes

Classes are types that specify an inheritance relationship and can have associated structured data through properties.
 <class> (<type>) C
 class-name (x|<class> => (t? <sym>)) G
returns class name or false otherwise.
 class-parents (x|<class> => <seq>) G
direct superclasses.
 class-ancestors (x|<class> => <seq>) G
class precedence list including this class. See Appendix * for details.
 class-direct-props (x|<class> => <seq>) G
properties defined directly on this class.
 class-props (x|<class> => <seq>) G
properties defined on this class or any superclass.
 class-children (x|<class> => <seq>) G
direct subclasses.
 DC (DC ,name (,@parents)) S
defines a class named ,name with direct parents ,@parents
 new (type|<class> prop-inits|...) M
creates an instance of type type and prop initialized as specified by prop-inits. For example, (new <point> point-x 1 point-y 2) creates a point with x=1 and y=2.

Properties

Properties are named data associated with classes. Their values are accessed exclusively through generic functions, called getters and setters. Descriptions of properties are instances of <prop>. Property values can either be specified at creation time with keyword arguments, by calling a property setter, or through a property initialization function called lazily the first time a getter is called if the property is otherwise uninitialized. Property initialization functions are called with a single argument, the object under construction.
 <prop> (<any>) C
 prop-owner (x|<prop> => <any>) P
class on which property was directly defined.
 prop-getter (x|<prop> => <gen>) P
reader accessor generic.
 prop-setter (x|<prop> => <gen>) P
writer accessor generic.
 prop-type (x|<prop> => <type>) P
type constraining property value.
 prop-init (x|<prop> => <fun>) P
lazy initialization function.
 find-getter (c|<class> getter|<gen> => <met>) G
finds getter method defined on given class.
 find-setter (c|<class> setter|<gen> => <met>) G
finds setter method defined on given class.
 prop-bound? (x g|<gen> => <log>) P
returns true if property with getter g is bound in instance x.
 add-prop (owner getter|<gen> setter|<gen> type|<type> init|<fun>) M
where init is a one parameter function that returns the initial value for the prop and gets called lazily with the new instance as the argument.
 DP (DP ,name (,oname|,owner => ,type) [,@init]) S
add's an immutable property to ,owner with getter named ,name, type ,type, and optionally initial value ,init. The initial value function is evaluated lazily when prop's value is first requested.
 DP! (DP! ,name (,oname|,owner => ,type) [,@init]) S
same as DP but mutable with setter named ,name ## "-setter"


Types, Classes and PropertiesProductClasses