* [bug #31445] Incorrect multiple-value truncation [1.9.13]
@ 2010-10-25 9:57 Ludovic Courtès
2010-11-18 19:35 ` Andy Wingo
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2010-10-25 9:57 UTC (permalink / raw)
To: Ludovic Courtès, bug-guile
URL:
<http://savannah.gnu.org/bugs/?31445>
Summary: Incorrect multiple-value truncation [1.9.13]
Project: Guile
Submitted by: civodul
Submitted on: Mon 25 Oct 2010 09:57:33 AM GMT
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
This is with `map' implemented in C:
#v+
scheme@(guile-user)> (map (lambda (x) (values x x)) (iota 2))
$5 = (#<values (0 0)> #<values (1 1)>)
scheme@(guile-user)> ,x map
Disassembly of #<procedure map (_ _ . _)>:
0 (assert-nargs-ge 0 2)
3 (push-rest 0 2)
6 (object-ref 0) ;; #<pointer 0x7f4ee0395d20>
8 (subr-call 3)
#v-
Instead, the result should be '(0 1).
Conversely:
#v+
scheme@(guile-user)> (map (lambda (x) (identity (values x x))) (iota 2))
$6 = (0 1)
scheme@(guile-user)> ,x identity
Disassembly of #<procedure identity (x)>:
0 (assert-nargs-ee/locals 1)
2 (local-ref 0) ;; `x'
4 (return)
#v-
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?31445>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [bug #31445] Incorrect multiple-value truncation [1.9.13]
2010-10-25 9:57 [bug #31445] Incorrect multiple-value truncation [1.9.13] Ludovic Courtès
@ 2010-11-18 19:35 ` Andy Wingo
2010-11-18 21:31 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Andy Wingo @ 2010-11-18 19:35 UTC (permalink / raw)
To: Ludovic Courtès, Andy Wingo, bug-guile
Follow-up Comment #1, bug #31445 (project guile):
This is not a regression, as the results would have been the same before 1.9.
But clearly it's not ideal either.
I propose we add new API, scm_call_0_v, scm_apply_3_v, etc. Such code would
truncate or raise an error for 0 values. Then we change all internal users to
use the new code, if appropriate.
WDYT?
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?31445>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [bug #31445] Incorrect multiple-value truncation [1.9.13]
2010-11-18 19:35 ` Andy Wingo
@ 2010-11-18 21:31 ` Ludovic Courtès
2010-11-19 15:39 ` Andy Wingo
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2010-11-18 21:31 UTC (permalink / raw)
To: Ludovic Courtès, Andy Wingo, bug-guile
Follow-up Comment #2, bug #31445 (project guile):
Hmm, maybe that's a complex solution for a situation that'll be less and less
common, especially when `map' & co. are rewritten in Scheme.
WDYT?
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?31445>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [bug #31445] Incorrect multiple-value truncation [1.9.13]
2010-11-18 21:31 ` Ludovic Courtès
@ 2010-11-19 15:39 ` Andy Wingo
0 siblings, 0 replies; 4+ messages in thread
From: Andy Wingo @ 2010-11-19 15:39 UTC (permalink / raw)
To: Ludovic Courtès, Andy Wingo, bug-guile
Follow-up Comment #3, bug #31445 (project guile):
I could go either way. I think using a single-valued, truncating API is the
right thing to do though. Grep your tree for scm_call_ and scm_apply to see
the size of the set of current use cases.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?31445>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-19 15:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-25 9:57 [bug #31445] Incorrect multiple-value truncation [1.9.13] Ludovic Courtès
2010-11-18 19:35 ` Andy Wingo
2010-11-18 21:31 ` Ludovic Courtès
2010-11-19 15:39 ` Andy Wingo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).