diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-12-04 01:58:26 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-12-09 00:54:20 +0100 |
commit | ffd0a028aefd203b4a42ded1e5a592e1b4d92dd7 (patch) | |
tree | 7176aa23610558fde1c020ae0b096d2f43bc9dc7 /doc/ref/object/object.texi | |
parent | Cleanup datetime tests. (diff) | |
download | calp-ffd0a028aefd203b4a42ded1e5a592e1b4d92dd7.tar.gz calp-ffd0a028aefd203b4a42ded1e5a592e1b4d92dd7.tar.xz |
Complete rewrite of the lens system.
The old "lens" system was more of nested accessors. This rewrites them
to be much better, at the cost of some extra up-front complexity.
Beside the change in lenses, and all required adjustments, also adds
lens creation to the define-type macro.
Diffstat (limited to 'doc/ref/object/object.texi')
-rw-r--r-- | doc/ref/object/object.texi | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/doc/ref/object/object.texi b/doc/ref/object/object.texi index a21ae9ea..f56a8162 100644 --- a/doc/ref/object/object.texi +++ b/doc/ref/object/object.texi @@ -89,6 +89,26 @@ symbol, and @emph{not} a keyword object. @end example @end deffn +@deffn {Field Parameter} #:accessor name +Explicit name for the accessor of this field. Will otherwise use the +fields name. + +Each accessor is a procedure which either +@itemize +@item retrives the field from the record (if one argument was given), or +@item returns a new record with that field replaced (if two arguments +where given). +@end itemize + +@end deffn + +@deffn {Field Parameter} #:lens name +Explicit name for the lens +@c TODO link to lens documentation +focusing this field. Will use the fields +name, with a star (``*'') appended by if unset.. +@end deffn + Each type introduces a number of bindings, which are@footnote{ @var{<name>} here refers to the name of the type }: @@ -104,12 +124,4 @@ Type predicate. And for each field @var{<field>}: -@defun @var{<field>} object [value] -Accessor for the given filed. -Returns the current value if called with only an object, and returns a -new object with @var{field} set to @var{value} if called with two values. - -The updating version checks the type if #:type was given on creation. -@end defun - @end defmac |