bugGuile - Bugs: bug #30611, [1.8.7] (ice-9 optargs) mixes...

 
 

bug #30611: [1.8.7] (ice-9 optargs) mixes keyword and optional args

Submitter:  Mike Gran <mike121>
Submitted:  Sat 31 Jul 2010 04:49:35 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Wont Fix
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 06 Sep 2011 09:32:58 PM UTC, comment #3: 

2.0.x behaves the same as 1.9.11, and thus differently from 1.8 in this example.  The difference wasn't documented in NEWS as it should, but now it's there, so I'll just close the bug.

Ludovic Courtès <civodul>
Group administrator
Sun 01 Aug 2010 12:12:58 PM UTC, comment #2: 

Even if one were to make the argument that 1.8.7's behavior of having a key be read as an optional argument was valid, silently dropping the "3" in the (func 1 #:c 3) in the previous example is problematic.

Consider the following behavior.

$ (define* (funk #:key a) #t)
$ (funk 1 2 3)
=> #t

$ (define* (funk) #t)
$ (funk 1 2 3)
=> ABORT: wrong number of args

IMHO, the first of these two examples should also trigger a wrong-number-of-args error.

Mike Gran <mike121>
Group Member
Sun 01 Aug 2010 08:41:14 AM UTC, comment #1: 

How do you know one is correct and the other is not?

If you are saying that 1.9.11's behavior is more intuitive, I agree. We probably need to document this incompatibility in the 1.9.11 NEWS, however.

Andy Wingo <wingo>
Group administrator
Sat 31 Jul 2010 04:49:35 AM UTC, original submission:  

In 1.8.7, the (ice-9 optargs) library does not correctly handle
define*'s that have both optional and keyword arguments.

Consider the following

guile> (use-modules (ice-9 optargs))
guile> (define* (func a #:optional b #:key c) (list a b c))
guile> (func 1 #:c 3)

1.8.7 returns (1 #:c #f).  The correct answer is (1 #f 3)

But, this works in 1.9.11.


Mike Gran <mike121>
Group Member

 

(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 civodul (Posted a comment)
  • -email is unavailable- added by wingo (Posted a comment)
  • -email is unavailable- added by mike121 (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.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-09-06 civodul StatusNone Wont Fix
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code