chickadee » moremacros » warning-guard

(warning-guard GETTER-NAME TYPENAME [BODY...])syntax

Constructs a variable or parameter guard procedure that generates a warning and returns the current value when the type predicate fails, otherwise the submitted value is returned.

TYPENAME is an identifier and TYPENAME? is a (procedure (*) boolean).

GETTER-NAME is an identifier and the name of a procedure _ *.

BODY is zero or more expressions that are performed after a successful typecheck. Note that since the guard is invoked by a variable or parameter during initialization, so will be the body code.

(use variable-item)

(warning-guard some-var integer)