unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: <tomas@tuxteam.de>
To: Massimiliano Gubinelli <m.gubinelli@gmail.com>
Cc: guile-user <guile-user@gnu.org>, Matt Wette <matt.wette@gmail.com>
Subject: Re: question about values
Date: Wed, 18 Mar 2020 16:08:56 +0100	[thread overview]
Message-ID: <20200318150856.GC5858@tuxteam.de> (raw)
In-Reply-To: <C81D72CC-3DA3-4AB7-A29D-A2652E655F5A@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1335 bytes --]

On Wed, Mar 18, 2020 at 03:48:03PM +0100, Massimiliano Gubinelli wrote:
> 
> > On 18. Mar 2020, at 15:40, Massimiliano Gubinelli <m.gubinelli@gmail.com> 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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2020-03-18 15:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17 23:50 question about values Massimiliano Gubinelli
2020-03-18  6:12 ` Taylan Kammer
2020-03-18  9:55   ` Massimiliano Gubinelli
2020-03-18 11:06     ` Massimiliano Gubinelli
2020-03-18 12:39     ` Matt Wette
2020-03-18 13:11       ` Massimiliano Gubinelli
2020-03-18 14:06         ` John Cowan
2020-03-18 14:40           ` Massimiliano Gubinelli
2020-03-18 14:48             ` Massimiliano Gubinelli
2020-03-18 15:08               ` tomas [this message]
2020-03-18 15:34                 ` Massimiliano Gubinelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200318150856.GC5858@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=guile-user@gnu.org \
    --cc=m.gubinelli@gmail.com \
    --cc=matt.wette@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).