chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] Re: #443: #!rest and #!key are not internally consist


From: Chicken Trac
Subject: [Chicken-janitors] Re: #443: #!rest and #!key are not internally consistent
Date: Sat, 11 Dec 2010 16:57:50 -0000

#443: #!rest and #!key are not internally consistent
-----------------------------+----------------------------------------------
  Reporter:  alanpost        |       Owner:       
      Type:  defect          |      Status:  new  
  Priority:  minor           |   Milestone:  4.7.0
 Component:  core libraries  |     Version:  4.6.x
Resolution:                  |    Keywords:       
-----------------------------+----------------------------------------------

Comment(by alanpost):

 Here is the use case I have in mind that makes this behavior frustrating.

 Imagine I have a library that is given a callback.  I am going to call the
 callback procedure with a set of #!key arguments and a set of positional
 arguments.  It would be very nice if I could call the procedure with a
 finite set of #!key arguments and a variable number of positional
 arguments.  I *can* actually do that, as show in the "initial+rest" test.
 Good!

 Now imagine instead the same callback, but the caller *knows* how many
 arguments they're getting, they want to do away with variable number of
 positional arguments and explicitly name them.  They change the signature
 from "initial+rest" to "initial", and now suddenly they are not able to
 bind #!key arguments.

 Instead, *I* have to change the way I call the routine from the calling
 site.  I've become the "end" test case, except now callers that were
 "initial+rest" are now "end+rest," and suddenly they don't work!

 If I want my calling site to accommodate both kinds of callback routines,
 and I can't.  I have to know whether the client is using #!rest or not,
 and alter the placement of my #!key arguments when I call the function.

 Essentially, it is impossible to have both #!key arguments and a variable
 number of positional arguments.

 I understand that this follows from the *implementation* of #!rest and
 #!key, but from the perspective of someone using these features, it looks
 arbitrary, particularly when "middle+rest (2)" is the only "middle"* test
 that does so.

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/443#comment:4>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]