[COMMITTED] a68: add coding guideline on enquiry clauses

Jose E. Marchesi jemarch@gnu.org
Wed Feb 11 22:05:23 GMT 2026


Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>

gcc/algol68/ChangeLog

	* ga68-coding-guidelines.texi (Enquiry clauses): New section.
---
 gcc/algol68/ga68-coding-guidelines.texi | 26 +++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gcc/algol68/ga68-coding-guidelines.texi b/gcc/algol68/ga68-coding-guidelines.texi
index ee68d7ae853..ef0bcfc4acc 100644
--- a/gcc/algol68/ga68-coding-guidelines.texi
+++ b/gcc/algol68/ga68-coding-guidelines.texi
@@ -773,6 +773,7 @@ facilities of the language.
 
 @menu
 * Writing routines::
+* Enquiry clauses::
 * Nihils::
 @end menu
 
@@ -813,6 +814,31 @@ it may be wise to judiciously pass those non-nearby values as
 arguments in order that the programmer be aware that non-nearby values
 are being accessed or possibly altered.
 
+@node Enquiry clauses
+@section Enquiry clauses
+
+@dfn{Enquiry clauses} are not just ``boolean expressions'' with a
+fancy name.  They can be thought as a sort of specialized serial
+clauses, and as such they can contain any number of declarations and
+units while being required to always yield a value of mode
+@code{bool}.
+
+Avoid polluting the lexical environment with declarations that are
+intended to be used exclusively within conditional and loop clauses:
+use a declaration in the enquiry-clause of the clause instead.  This
+also makes it easier to later refactor code.
+
+Examples:
+
+@example
+@{ The range of `c' is the entire loop clause. @}
+while char c = getchar;
+      c /= char_eof
+do
+   ... use c ...
+od
+@end example
+
 @node Nihils
 @section Nihils
 
-- 
2.39.5



More information about the Algol68 mailing list