[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] "unspecified values"
- To: Alex Shinn <alexshinn@x>
- Subject: Re: [Scheme-reports] "unspecified values"
- From: Andy Wingo <wingo@x>
- Date: Sat, 21 May 2011 10:51:49 +0200
- Cc: scheme-reports@x
- In-reply-to: <BANLkTin5W6w+RLHjvM=o8Rz2+8u4YJWWOw@mail.gmail.com> (Alex Shinn's message of "Fri, 20 May 2011 21:59:51 -0700")
- References: <email@example.com> <4DD540F3.firstname.lastname@example.org> <email@example.com> <BANLkTin5W6w+RLHjvM=o8Rz2+8u4YJWWOw@mail.gmail.com>
On Sat 21 May 2011 06:59, Alex Shinn <alexshinn@x> writes:
> (define-syntax time
> ((time expr)
> (let* ((start (current-time))
> (res expr))
> (report-time 'expr start (current-time))
This is actually an incorrect program. If `expr' returns two values,
you want to return them to the continuation. You need:
(let ((start (current-time)))
(call-with-values (lambda () expr)
(report-time 'expr start (current-time))
(apply values vals))))
> Now, you may dislike these idioms, and argue in
> particular that the first doesn't work if expr returns
> multiple values, but it works fine for users who were
> not previously using MV in that context, or perhaps
> in any of their code. And using MV at all is still a
> contentious issue for some people. There's a
> difference between providing a feature, forcing
> people to use that feature in new code, and forcing
> them to rewrite their old code to support the feature.
> We debated this and voted strongly in favor of not
> breaking existing code.
If you like this idiom, you are not interested in portable code,
cf. values: if expr returns 0 values, the implementation is allowed to
I think it's OK to be uninterested in portable code. But don't restrict
all the implementations that *do* want to change because users have
programs that aren't even valid for R5.
Scheme-reports mailing list