From 68d27225b47bf85be43a8a33e619b61486e55ca2 Mon Sep 17 00:00:00 2001 From: colin Date: Thu, 30 Nov 2023 19:03:48 -0800 Subject: More name refinement --- README.org | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'README.org') diff --git a/README.org b/README.org index 4fe65a2..690f053 100644 --- a/README.org +++ b/README.org @@ -2,7 +2,7 @@ Terrafirma is a small system for defining data type validators that produce nice error messages on invalid data. -Terrafirma's main export is the =DEFVALIDATOR= macro. This macro defines a validator function. The body of the validator function evalutes in a special context. Within this context, the symbol =VALIDATE= is a macro that can be used to check predicates and singal a =VALIDATION-ERROR= upon failure: basically just a wrapper around =ASSERT=. +Terrafirma's main export is the =DEFINE-VALID= macro. This macro defines a validator function. The body of the validator function evalutes in a special context. Within this context, the symbol =VALIDATE= is a macro that can be used to check predicates and singal a =VALIDATION-ERROR= upon failure: basically just a wrapper around =ASSERT=. The real "magic" happens when validation functions are defined in terms of other validation functions. In that case, validation errors are nested to produce highly-specific messages for your validation error. @@ -21,7 +21,7 @@ Here is an example: ;; defines a function called VALID-POINT-P. By default the name of the ;; type is used to create the validator function's name. -(defvalidator point (pt) +(define-valid point (pt) (validate (and (slot-boundp pt 'x) (slot-boundp pt 'y)) "Both X and Y must be bound.") (with-slots (x y) pt @@ -32,9 +32,9 @@ Here is an example: ((verts :initarg :verts :type (cons point)))) ;; defines a function called VALID-POLY-P. Here we pass a specific -;; name in. We also define this validator in terms of gthe +;; name in. We also define this validator in terms of the ;; VALID-POLY-P validator. -(defvalidator polygon (p :name valid-poly-p) +(define-valid polygon (p :name valid-poly-p) (validate (slot-boundp p 'verts) "VERTS must be bound.") (let ((verts (slot-value p 'verts))) (validate (< 2 (length verts)) "VERTS must contain at least three points.") @@ -68,4 +68,4 @@ Now, call =VALID-POLY-P= on a couple of bad polygons. -See the docstring on =DEFVALIDATOR= for use details. +See the docstring on =DEFINE-VALID= for use details. -- cgit v1.2.3