From ffd0a028aefd203b4a42ded1e5a592e1b4d92dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 4 Dec 2023 01:58:26 +0100 Subject: 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. --- doc/ref/object/object.texi | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'doc/ref/object/object.texi') 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{} here refers to the name of the type }: @@ -104,12 +124,4 @@ Type predicate. And for each field @var{}: -@defun @var{} 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 -- cgit v1.2.3