gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet-scheme] 101/324: utils: hat-let: Add <--, a variant on <-.


From: gnunet
Subject: [gnunet-scheme] 101/324: utils: hat-let: Add <--, a variant on <-.
Date: Tue, 21 Sep 2021 13:22:21 +0200

This is an automated email from the git hooks/post-receive script.

maxime-devos pushed a commit to branch master
in repository gnunet-scheme.

commit 08ef041ccc6d4b5deaa659a354ebf67f76d3ebff
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Sun Mar 28 21:09:43 2021 +0200

    utils: hat-let: Add <--, a variant on <-.
    
    The old <- accepts a thunk expression instead of a raw
    expression, which is a historical mistake.
    
    * gnu/gnunet/utils/hat-let.scm
      (let^)[<-]: Deprecate.
      (let^)[<--]: Define a variant that accepts expressions
      to evaluate instead.
      (Mini changelog): Bump the version number.
---
 gnu/gnunet/utils/hat-let.scm | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/gnu/gnunet/utils/hat-let.scm b/gnu/gnunet/utils/hat-let.scm
index 2036c62..8c6e468 100644
--- a/gnu/gnunet/utils/hat-let.scm
+++ b/gnu/gnunet/utils/hat-let.scm
@@ -16,25 +16,28 @@
 ;;   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ;;
 ;;   SPDX-License-Identifier: AGPL-3.0-or-later
-;;
-;;   As a special exception to the GNU Affero General Public License,
-;;   the file may be relicensed under any license used for
-;;   most source code of GNUnet 0.13.1, or later versions, as published by
-;;   GNUnet e.V.
 
 ;; Author: Maxime Devos
 ;; Source: gnu/gnunet/utils/hat-let.scm
 ;; Brief: a combination of various binding constructs
 ;; Status: stable, exported, pure+assert
 
-(library (gnu gnunet utils hat-let (1))
+;; Mini changelog:
+;;   * (1): Original version.
+;;   * (2): (2021)
+;;          Mark the behaviour of <- as a historical mistake.
+;;          Suggest the new <-- instead.
+;;          <- might eventually be removed or be replaced
+;;          with <--.
+
+(library (gnu gnunet utils hat-let (2))
   (export let^)
   (import (rnrs base))
 
   ;; A generalisation of let*, and-let*, receive, begin,
   ;; and generalised let for avoiding nesting.
   (define-syntax let^
-    (syntax-rules (? ! !! _ <- /o/)
+    (syntax-rules (? ! !! _ <- <-- /o/)
       ((: () code ...)
        (let () code ...))
       ;; if x, then return @code{(begin esc esc* ...)}
@@ -61,12 +64,19 @@
        (begin
         x
         (let^ (etc ...) code ...)))
-      ;; Assign multiple values
-      ((: ((<- (x ...) produce) etc ...) code ...)
-       (call-with-values produce
+      ;; Assign multiple values (from a thunk).
+      ;; This is a historical mistake, use <--
+      ;; instead (see mini changelog).
+      ((: ((<- (x ...) thunk) etc ...) code ...)
+       (call-with-values thunk
         (lambda (x ...)
           (let^ (etc ...)
                 code ...))))
+      ;; Assign multiple values.
+      ((: ((<-- (x ...) exp) etc ...) code ...)
+       (call-with-values (lambda () exp)
+        (lambda (x ...)
+          (let^ (etc ...) code ...))))
       ;; Tail-call into a generalised let
       ((: ((/o/ loop (x y) ...) etc ...) code ...)
        (let loop ((x y) ...)

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]