Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!bloom-beacon!dont-send-mail-to-path-lines From: pavel@parc.xerox.COM (Pavel Curtis) Newsgroups: comp.lang.scheme Subject: Re: Multiple return values Message-ID: <91Apr4.094933pst.40706@lambda.parc.xerox.com> Date: 4 Apr 91 17:49:31 GMT References: Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 95 "Guillermo J. Rozas" writes: > There are a lot of issues in multiple values that haven't been > mentioned. I like to classify them by code. Here are some of the > more controversial points. I give below the answers for SchemeXerox. > A: Are the following two expressions equivalent? > (values 1) > 1 Yes. > B: Is the following expression legal? > (begin > (values 1 2 3) > 4) Yes. > C: Is the following expression legal? > (begin > (values) > 4) Yes. > D: Is the following expression legal, and, if so, what does it return? > (let ((x (values 1 2))) > x) No; it signals an error about a wrong number of arguments (to the implicit continuation). > E: Is the following expression legal, and, if so, what does it return? > (let ((x (values))) > x) No; same error as above. > F: Is the following expression legal? > (call-with-values > (lambda () > (values 1 2 3)) > (lambda (x y) > (list x y))) Ditto. > G: Is the following expression legal, and, if so, what does it return? > (call-with-values > (lambda () > (values 1)) > (lambda (x y) > (list x y))) Ditto. > H: Does the following work? > (call-with-values > (lambda () > (call-with-current-continuation > (lambda (k) > (k 1 2)))) > (lambda (x y) > (list x y))) Yes. > My preferences are: > A: Yes. > B: Yes. > C: Yes. > D: Yes, 1. > E: No. > F: No. > G: No. > H: Yes. Well, Jinx, what a wonder. We appear to disagree only on D, where you want to silently ignore extra returned values and SchemeXerox signals an error. Were we to agree to leave D unspecified, though, I'd want to do the same with E, F, and G: passing the wrong number of arguments to a continuation is passing the wrong number of arguments to a continuation. On the other hand, we could also say that the implicit single-argument continuations can have either of the following (implicit) argument list structures: (x) ; The SchemeXerox approach (x . ignored) ; The Jinx approach I could probably live with this compromise as well. Pavel Curtis