OMG Lightweight Log

T

tjr7933

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 <[email protected]>
Subject: PCL question about using &rest and &key parameters together
X-Nntp-Posting-Host: medea.sea.boeing.com
Content-Type: text/plain; charset=ISO-8859-1
Message-ID: <[email protected]>
User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.)
Sender: (e-mail address removed) (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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top