It's idiomatic PLT Scheme to use WHEN and UNLESS if one wants to do a side-effect conditional. But the standard mzscheme language still allows one-armed if expressions. This can invite bug-prone code, so we may want to restrict the language to prevent one-armed if's in our own code.
We can write a custom language, and then use that language. Our new language will have mostly everything from mzscheme, but leave out the one-armed if.
(moduleno-one-armed-ifmzscheme;; This module reduces the mzscheme language and disallows
;; the one-armed if expression.
(provide (all-from-exceptmzschemeif))
(provide (renamemy-ifif))
(define-syntax (my-ifstx)
(syntax-casestx ()
[(my-iftestarm-1arm-2)
(syntax/locstx
(iftestarm-1arm-2))]
[else (raise-syntax-error#f"both arms of an if are required"stx)])))
Once we have such a module language, we can then use it. The following code will raise a syntax error: