FunctionPackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
New since the initial 10.1 release.

with-at-most-one-form

Arguments: (&key if-null-body) &body body

The purpose of this macro is to ensure that one and only one of a set of conditionalized forms results from the evaluation of body. So in an example below, we conditionalize for Linux and Windows. If later we start running on a Mac, the with-at-most-one-form will error because we forgot to add a mac-conditionalized form.

When a with-at-most-one-form is macroexpanded, the result is either:

Examples

;; This would signal an error at macroexpand time if run on a
;; non-Linux or non-Windows version of Allegro CL:
(with-at-most-one-form ()
  #+linux (do-linux-stuff)
  #+mswindows (do-windows-stuff))

;; The result of this form would be 10 on Windows and 11 elsewhere:
(with-at-most-one-form (:if-null-body 11)
  #+mswindows 10)

;; This call will always error (at macroexpand time) as body has
;; two forms:
(with-at-most-one-form ()
  (setq author "Bill")
  (setq editor "Helen"))
-> ERROR

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page is new in the 10.1 release.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
New since the initial 10.1 release.