bug#71301: [PATCH] module: Add some docstrings to (system base compile).

Maxim Cournoyer <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <[email protected]>
* module/system/base/compile.scm (next-pass): Add doc.
(compute-compiler, read-and-compile, compile): Likewise.

---

 module/system/base/compile.scm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm
index f7e82404e..2468d1dab 100644
--- a/module/system/base/compile.scm
+++ b/module/system/base/compile.scm
@@ -232,6 +232,9 @@
     (proc (proc optimization-level opts))))
 
 (define (next-pass from lang to optimization-level opts)
+  "Return a pair containing the next target language name and its
+associated compilation procedure (pass) required to compile LANG from
+FROM to TO."
   (if (eq? lang to)
       #f ;; Done.
       (match (language-compilers lang)
@@ -248,6 +251,11 @@
               (cons (lookup-language name) pass))))))))
 
 (define (compute-compiler from to optimization-level warning-level opts)
+  "Return a procedure accepting an EXP and ENV arguments that lookup and
+invoke the necessary compiler(s) to compile EXP from FROM to TO.  The
+returned procedure returns the compiled expression (exp), the
+environment (env) as well as a continuation environment (cenv) as
+multiple values."
   (let ((from (ensure-language from))
         (to (ensure-language to)))
     (let lp ((lang from))
@@ -302,6 +310,8 @@
                            (optimization-level (default-optimization-level))
                            (warning-level (default-warning-level))
                            (opts '()))
+  "Return the compiled bytevector (or the format of the chosen TO target
+language) of the source read from PORT."
   (let* ((from (ensure-language from))
          (to (ensure-language to))
          (joint (find-language-joint from to optimization-level opts)))
@@ -346,6 +356,7 @@
                   (optimization-level (default-optimization-level))
                   (warning-level (default-warning-level))
                   (opts '()))
+  "Return the compiled bytecode of X, an expression."
   (validate-options opts)
   (let ((compile1 (compute-compiler from to optimization-level
                                     warning-level opts)))

base-commit: 779a83d9c682345802f9a605cb8e2b4892129316
-- 
2.41.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.