unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: David Kastrup <dak@gnu.org>
To: ludo@gnu.org (Ludovic Courtès)
Cc: 17474@debbugs.gnu.org
Subject: bug#17474: Making *unspecified* equivalent to (values) would seem convenient
Date: Mon, 12 May 2014 21:49:43 +0200	[thread overview]
Message-ID: <877g5qvktk.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <87egzyajm2.fsf@gnu.org> ("Ludovic Courtès"'s message of "Mon, 12 May 2014 21:21:25 +0200")

ludo@gnu.org (Ludovic Courtès) writes:

> David Kastrup <dak@gnu.org> skribis:
>
>> ludo@gnu.org (Ludovic Courtès) writes:
>>
>>> R5RS defines ‘values’ as:
>>>
>>>      (define (values . things)
>>>        (call-with-current-continuation
>>>          (lambda (cont) (apply cont things))))
>>>
>>> Thus, a conforming implementation must raise a run-time error when the
>>> continuation of a (values) form expects one or more values.
>>
>> No.  From R5RS:
>>
>>  -- procedure: call-with-current-continuation proc
>>
>> [...]
>>
>>      The escape procedure accepts the same number of arguments as the
>>      continuation to the original call to
>>      call-with-current-continuation.  Except for continuations created
>>      by the `call-with-values' procedure, all continuations take
>>      exactly one value.  The effect of passing no value or more than
>>      one value to continuations that were not created by
>>      call-with-values is unspecified.
>
> Oh indeed, I stand corrected.
>
>> So this behavior is neither out of line, nor against the standard.  It
>> is merely a more convenient behavior for a situation that the standard
>> left unspecified.
>
> Right.
>
> I’m not completely convinced it makes sense to “specify” the zero values
> case in this way, but I’d like to hear what others think.

The real awkwardness is not when feeding (values) to a single-value
continuation but rather the ability of single-value expressions being
able to pass zero values to a multi-value continuation.

In Guilev1, there was a lot of those around, and indeed
(call-with-values (lambda () (car (list (values)))) list) => ()
in Guilev1.

But in Guile 2.0.9, I actually get the same, and I don't think people
reported bugs for that.

This design does not win a beauty contest.  But at least it fits several
parts of Guile and the API together in a less ugly and more satisfactory
manner than before while providing a really large amount of backward
compatibility.

I don't really know whether there are assumptions in the compiler it
might break.  So this change would certainly also want testing with
large applications and should not be introduced shortly before a stable
release.

-- 
David Kastrup





  reply	other threads:[~2014-05-12 19:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-12 11:40 bug#17474: Making *unspecified* equivalent to (values) would seem convenient David Kastrup
2014-05-12 15:53 ` Ludovic Courtès
     [not found] ` <8738gfyoxm.fsf@gnu.org>
2014-05-12 16:58   ` David Kastrup
2014-05-12 19:21     ` Ludovic Courtès
2014-05-12 19:49       ` David Kastrup [this message]
2014-06-22  5:25       ` Mark H Weaver
2014-06-22  6:09         ` David Kastrup
2014-06-21 21:30 ` bug#17474: Another point David Kastrup
2014-06-22  5:17   ` Mark H Weaver
2014-06-22  5:45     ` David Kastrup
2014-08-09  9:17 ` bug#17474: Ping? David Kastrup
2014-08-10 19:12   ` Mark H Weaver
2014-08-10 20:26     ` David Kastrup
2014-08-10 21:48       ` Mark H Weaver
2014-08-10 22:00       ` Mark H Weaver
2015-06-01 14:04         ` David Kastrup

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=877g5qvktk.fsf@fencepost.gnu.org \
    --to=dak@gnu.org \
    --cc=17474@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /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).