[Scheme-reports] "unspecified values" Andy Wingo (19 May 2011 15:49 UTC)
Re: [Scheme-reports] "unspecified values" Alaric Snell-Pym (19 May 2011 16:11 UTC)
Re: [Scheme-reports] "unspecified values" Andy Wingo (19 May 2011 17:11 UTC)
Re: [Scheme-reports] "unspecified values" Alex Shinn (21 May 2011 05:04 UTC)
Re: [Scheme-reports] "unspecified values" Andy Wingo (21 May 2011 08:52 UTC)
Re: [Scheme-reports] "unspecified values" Jim Rees (21 May 2011 13:58 UTC)
Re: [Scheme-reports] "unspecified values" Andy Wingo (21 May 2011 15:10 UTC)
Re: [Scheme-reports] "unspecified values" John Cowan (21 May 2011 18:24 UTC)
Re: [Scheme-reports] "unspecified values" Andy Wingo (22 May 2011 13:28 UTC)
Re: [Scheme-reports] "unspecified values" Andre van Tonder (21 May 2011 15:19 UTC)
Re: [Scheme-reports] "unspecified values" Alex Shinn (21 May 2011 18:19 UTC)
Re: [Scheme-reports] "unspecified values" Alaric Snell-Pym (23 May 2011 11:34 UTC)
Re: [Scheme-reports] "unspecified values" John Cowan (23 May 2011 15:57 UTC)
Re: [Scheme-reports] "unspecified values" Alaric Snell-Pym (23 May 2011 11:20 UTC)

Re: [Scheme-reports] "unspecified values" Andy Wingo 21 May 2011 08:51 UTC

On Sat 21 May 2011 06:59, Alex Shinn <alexshinn@gmail.com> writes:

>   (define-syntax time
>     ((time expr)
>      (let* ((start (current-time))
>             (res expr))
>       (report-time 'expr start (current-time))
>       res)))

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)
      (lambda vals
        (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
crash.

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.

Andy
--
http://wingolog.org/

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports