bugGuile - Bugs: bug #31445, Incorrect multiple-value...

 
 

bug #31445: Incorrect multiple-value truncation [1.9.13]

Submitted by:  Ludovic Courtès <civodul>
Submitted on:  Mon 25 Oct 2010 09:57:33 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 19 Nov 2010 03:39:49 PM UTC, comment #3:

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.

Andy Wingo <wingo>
Project Administrator
Thu 18 Nov 2010 09:31:55 PM UTC, comment #2:

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?

Ludovic Courtès <civodul>
Project Administrator
Thu 18 Nov 2010 07:35:26 PM UTC, comment #1:

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?

Andy Wingo <wingo>
Project Administrator
Mon 25 Oct 2010 09:57:33 AM UTC, original submission:

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-

Ludovic Courtès <civodul>
Project Administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by wingo (Posted a comment)
  • -unavailable- added by civodul (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup