The contents of contrib/fluid-let.scm: (require 'fluid-let) (define a 33) (write (fluid-let ((a 55)) (+ a 11))) (newline)
Running Guile-3.0.9 with SLIB, loading the file fails, but fluid-let works from the interactive REPL: jaffer@jaffer-Vivobook-ASUSLaptop-X1703ZA-K1703ZA:~/slib$ slib guile GNU Guile 3.0.9 Copyright (C) 1995-2023 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> (load "contrib/fluid-bug.scm") ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /home/jaffer/slib/contrib/fluid-bug.scm ;;; /home/jaffer/slib/contrib/fluid-bug.scm:6:8: warning: possibly unbound variable `fluid-let' ;;; compiled /home/jaffer/.cache/guile/ccache/3.0-LE-8-4.6/home/jaffer/slib/contrib/fluid-bug.scm.go ice-9/boot-9.scm:1685:16: In procedure raise-exception: Wrong type to apply: 33 Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guile-user) [1]> (write (fluid-let ((a 55)) (+ a 11))) (newline) 66 The definition of the fluid-let macro is attached.
; "fluidlet.scm", FLUID-LET for Scheme ; Copyright (c) 1998, Radey Shouman <[email protected]> ; ;Permission to copy this software, to redistribute it, and to use it ;for any purpose is granted, subject to the following restrictions and ;understandings. ; ;1. Any copy made of this software must include this copyright notice ;in full. ; ;2. I have made no warrantee or representation that the operation of ;this software will be error-free, and I am under no obligation to ;provide any services, by way of maintenance, update, or otherwise. ; ;3. In conjunction with products arising from the use of this ;material, there shall be no use of my name in any advertising, ;promotional, or sales literature without prior written consent in ;each case. (require 'dynamic-wind) (require 'macro) (define-syntax fluid-let (syntax-rules () ((_ ((?name ?val) ...) . ?body) (fluid-let "make-temps" ((?name ?val) ...) () () ((?name ?val) ...) . ?body)) ((_ "make-temps" (?bind1 . ?binds) ?olds ?news . ?rest) (fluid-let "make-temps" ?binds (old-tmp . ?olds) (new-tmp . ?news) . ?rest)) ((_ "make-temps" () (?old ...) (?new ...) ((?name ?val) ...) . ?body) (let ((?new ?val) ... (?old #f) ...) (dynamic-wind (lambda () (set! ?old ?name) ... (set! ?name ?new) ...) (lambda () . ?body) (lambda () (set! ?new ?name) ... (set! ?name ?old) ...))))))
