GNU bug report logs -
#13966
Inconsistent truncation of multiple values, inlining issue?
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13966 in the body.
You can then email your comments to 13966 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org
:
bug#13966
; Package
guile
.
(Fri, 15 Mar 2013 13:08:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Daniel Llorens <daniel.llorens <at> bluewin.ch>
:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org
.
(Fri, 15 Mar 2013 13:08:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Compare
(define f (lambda (a) a))
(call-with-values (lambda () (values 3 3)) f)
vs
(call-with-values (lambda () (values 3 3)) (lambda (a) a))
The first one fails with
<unnamed port>:1:0: In procedure f:
<unnamed port>:1:0: Wrong number of arguments to #<procedure f (a)>
The second one gives 3.
This is Guile 2.0.7.112-f5ea5.
The behavior of the first case makes (compose f g) fail when f takes less args tan g produces.
Regards
Daniel
Information forwarded
to
bug-guile <at> gnu.org
:
bug#13966
; Package
guile
.
(Fri, 22 Mar 2013 13:58:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 13966 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Daniel,
Daniel Llorens <daniel.llorens <at> bluewin.ch> skribis:
> Compare
>
> (define f (lambda (a) a))
> (call-with-values (lambda () (values 3 3)) f)
>
> vs
>
> (call-with-values (lambda () (values 3 3)) (lambda (a) a))
>
> The first one fails with
>
> <unnamed port>:1:0: In procedure f:
> <unnamed port>:1:0: Wrong number of arguments to #<procedure f (a)>
>
> The second one gives 3.
>
> This is Guile 2.0.7.112-f5ea5.
>
> The behavior of the first case makes (compose f g) fail when f takes less args tan g produces.
That is unfortunate but I think the former is correct.
R5RS doesn’t say anything about the expected behavior when the producer
returns a number of values incompatible with what the consumer accepts.
R6RS says (Section 5.8):
If the number of return values passed to a continuation created by a
call to call-with-values is not accepted by its consumer that was
passed in that call, then an exception is raised.
and Section 11.5:
Consumer must be a procedure and should accept as many values as
producer returns.
R7RS draft #6 uses equivalent wording (I think):
Calls its producer argument with no values and a continuation that,
when passed some values, calls the consumer procedure with those
values as arguments.
This patch fixes peval to not inline
(call-with-values (lambda () (values vals ...)) (lambda (args ...) ...))
when the length of ‘vals’ differs from that of ‘args’.
However, it’s not very elegant, IMO. Andy?
Ludo’.
[Message part 2 (text/x-patch, inline)]
diff --git a/module/language/tree-il/peval.scm b/module/language/tree-il/peval.scm
index bf96179..25dded4 100644
--- a/module/language/tree-il/peval.scm
+++ b/module/language/tree-il/peval.scm
@@ -1155,6 +1155,25 @@ top-level bindings from ENV and return the resulting expression."
(simplify-conditional
(make-conditional src c (for-tail subsequent)
(for-tail alternate))))))
+
+ (($ <application> src
+ ($ <primitive-ref> _ '@call-with-values)
+ (($ <lambda> _ _
+ ($ <lambda-case> _
+ () #f #f #f () ()
+ ($ <application> _ ($ <primitive-ref> _ 'values)
+ (produced ...))
+ #f))
+ ($ <lambda> _ _
+ (and consumer
+ ($ <lambda-case> _
+ (? (negate (compose (cute = <> (length produced))
+ length)))
+ #f #f #f () gensyms body #f)))))
+ ;; Producer is (values args ...) but consumer expects a different
+ ;; number of values, which is an error.
+ exp)
+
(($ <application> src
($ <primitive-ref> _ '@call-with-values)
(producer
Changed bug title to 'Inconsistent truncation of multiple values, inlining issue?' from 'inlining issue?'
Request was from
Mark H Weaver <mhw <at> netris.org>
to
control <at> debbugs.gnu.org
.
(Thu, 25 Apr 2013 22:04:01 GMT)
Full text and
rfc822 format available.
Reply sent
to
Andy Wingo <wingo <at> pobox.com>
:
You have taken responsibility.
(Mon, 20 Jun 2016 20:08:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Daniel Llorens <daniel.llorens <at> bluewin.ch>
:
bug acknowledged by developer.
(Mon, 20 Jun 2016 20:08:02 GMT)
Full text and
rfc822 format available.
Message #15 received at 13966-done <at> debbugs.gnu.org (full text, mbox):
On Fri 15 Mar 2013 13:57, Daniel Llorens <daniel.llorens <at> bluewin.ch> writes:
> Compare
>
> (define f (lambda (a) a))
> (call-with-values (lambda () (values 3 3)) f)
>
> vs
>
> (call-with-values (lambda () (values 3 3)) (lambda (a) a))
>
> The first one fails with
>
> <unnamed port>:1:0: In procedure f:
> <unnamed port>:1:0: Wrong number of arguments to #<procedure f (a)>
>
> The second one gives 3.
>
> This is Guile 2.0.7.112-f5ea5.
>
> The behavior of the first case makes (compose f g) fail when f takes less args tan g produces.
Fixed in fff013215fb1a5d211df5037dcf52c92063050a8 on master.
Thanks for the report!
Andy
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 19 Jul 2016 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 290 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.