guile-user
[Top][All Lists]
Advanced

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

Re: question about values


From: tomas
Subject: Re: question about values
Date: Wed, 18 Mar 2020 16:08:56 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Mar 18, 2020 at 03:48:03PM +0100, Massimiliano Gubinelli wrote:
> 
> > On 18. Mar 2020, at 15:40, Massimiliano Gubinelli <address@hidden> wrote:
> > 
> > Good point with dynamic-wind. Does it pass along also multiple values or 
> > has the same problem?
> > 
> 
> Does not work...
> 
> mgubi@Ulrike guile3-usr % bin/guile
> GNU Guile 3.0.1
> Copyright (C) 1995-2020 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)> (call-with-values (lambda ()
>  (dynamic-wind (lambda () (display "initialize\n"))
>   (lambda () (let ((a (values "a" "b" "c"))) a))
               ^^^^^^ HERE
>   (lambda () (display "finalize\n"))))
>   (lambda body body))
> initialize
> finalize
> $1 = ("a")
> scheme@(guile-user)> 
> 
> Isn't this a bug??? In my view it breaks composability of scheme code.

Above, marked with HERE is the crocodile eating
your other values.

If you instead do, in that line

  (lambda () (values "a" "b" "c"))

then you get ("a" "b" "c").

The let binding construct only binds one value. There's a
"let-values" for that.

Cheers
-- tomás

Attachment: signature.asc
Description: Digital signature


reply via email to

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