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

Re: [Scheme-reports] Technical question





On Thu, May 26, 2011 at 6:07 PM, Andre van Tonder <andre@x> wrote:
On Thu, 26 May 2011, Eli Barzilay wrote:

> This is a question for WG1 (collectively):
>
> According to R5RS, is this code:
>
>  (call-with-values
>    (lambda ()
>      (call-with-current-continuation (lambda (k) (k 1 2 3))))
>    (lambda (x y z) 'ok))
>
> allowed to throw an error, or to return anything other than 'ok ?

It is /not/ allowed to throw an error in R5RS.  According to R5RS:

   Values might be defined as follows:

   (define (values . things)
     (call-with-current-continuation
       (lambda (cont) (apply cont things))))

so according to R5RS your example is equivalent to

  (call-with-values
    (lambda ()
      (values 1 2 3))
    (lambda (x y z) 'ok))

which must return OK.


My personal opinion is that this is "historically" true : values are there to pass multiple arguments to continuations and let continuations catch all of them correctly (which is not possible otherwise)

However I would say that the report is under-specified there, and let it open for other interpretations (because of wordings such as 'might' or 'deliver'). My concern was that this wording disallow reifying values (as many implementations decided to do it that way). 

So "Your mileages may vary".

In your opinions should we do something about it to be more precise ?

Best regards,
--
Emmanuel Medernach
_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports