Has anyone implemented the OMG lightweight log spec into a c++
application?
#! rnews 1946
Xref: xyzzy comp.lang.lisp: 150483
Newsgroups: comp.lang.lisp
Path: xyzzy!nntp
From: Jeffrey Cunningham <je************ ******@boeing.c om>
Subject: PCL question about using &rest and &key parameters together
X-Nntp-Posting-Host: medea.sea.boein g.com
Content-Type: text/plain; charset=ISO-8859-1
Message-ID: <pa************ *************** *@boeing.com>
User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.)
Sender: nn**@news.boein g.com (Boeing NNTP News Access)
Content-Transfer-Encoding: 8bit
Organization: The Boeing Company
Mime-Version: 1.0
Date: Tue, 17 May 2005 18:19:25 GMT
I was reading in Seibel's PCL the following:
You can safely combine &rest and &key parameters, but the behavior may be
a bit surprising initially. Normally the presence of either &rest or &key
in a parameter list causes all the values remaining after the required and
&optional parameters have been filled in to be processed in a particular
way--either gathered into a list for a &rest parameter or assigned to the
appropriate &key parameters based on the keywords. If both &rest and &key
appear in a parameter list, then both things happen--all the remaining
values, which include the keywords themselves, are gathered into a list
that's bound to the &rest parameter, and the appropriate values are also
bound to the &key parameters.
So I tried the following:
(defun foo (a &rest rest &key b c)
(list a rest b c))
(foo 1 2 :b 3 :c 4)
When I run it from slime, it bombs with the following error message:
Function called with odd number of keyword arguments.
[Condition of type KERNEL:SIMPLE-PROGRAM-ERROR]
Restarts:
0: [ABORT] Abort handling SLIME request. 1: [ABORT] Return to Top-Level.
Backtrace:
0: (C::%ODD-KEYWORD-ARGUMENTS-ERROR)
1: (NIL 1 (2 :B 3 :C 4) 5)[:OPTIONAL] 2: (SWANK::EVAL-REGION "(foo 1 2
:b 3 :c 4)
Any idea why this doesn't work as expected? I'm using CMUCL.
Thanks
--jeff cunningham