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

 
 

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

Submitter:  Ludovic Courtès <civodul>
Submitted:  Mon 25 Oct 2010 09:57:33 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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>
Group 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>
Group 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>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code