← Архив: Common Lisp

odd number of &KEY arguments

Author: · 19.12.2010 21:13
· original author: Jax
Возникает ошибка
odd number of &KEY arguments
[Condition of type SB-INT:SIMPLE-PROGRAM-ERROR]
Restarts:
0: [ABORT] Exit debugger, returning to top level.
Backtrace:
0: (CL-GLFW:OPEN-WINDOW)[:EXTERNAL]
1: (OPENGL-CONTEXT-START "abc")
2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (OPENGL-CONTEXT-START "abc") #)
3: (SB-EXT:INTERACTIVE-EVAL (OPENGL-CONTEXT-START "abc"))[:EXTERNAL]
4: (SB-IMPL::REPL-FUN NIL)
5: ((LAMBDA ()))
6: (SB-IMPL::%WITH-REBOUND-IO-SYNTAX #)
7: (SB-IMPL::TOPLEVEL-REPL NIL)
8: (SB-IMPL::TOPLEVEL-INIT)
9: ((LABELS SB-IMPL::RESTART-LISP))
При этом backtrace#0:
(defun open-window (&key (width 0) (height 0)
(redbits 0) (greenbits 0) (bluebits 0) (alphabits 0)
(depthbits 0) (stencilbits 0) (mode +window+))
А backtrace#1:
(unless (glfw:open-window *display-width* *display-height*
*red-bits* *green-bits* *blue-bits* *alpha-bits*
*depth-bits* *stencil-bits* *display-mode*)

В упор не вижу "лишних" параметров при вызове. В чем может быть дело?
· original author: Love5an
&key
· original author: Love5an
Это уже второй такой вопрос за четыре дня, причем
http://lisper.ru/forum/thread/470#comment-5060
· original author: lithp
А где сами ключи-то в параметрах?
· original author: Jax
If &key is specified, there must remain an even number of arguments; see Section 3.5.1.6 (Odd Number of Keyword Arguments). These arguments are considered as pairs, the first argument in each pair being interpreted as a name and the second as the corresponding value.
Не ясно только, почему сам автор этого не учел (или его CL позволял такие вольности).
· original author: Love5an
А что автор не учел?
Это пользователь должен учитывать, что каждый ключевой параметр при вызове надо передавать парой ключ-значение
 (unless (glfw:open-window
            :width *display-width*
            :height *display-height*
            :redbits *red-bits*
            :greenbits *green-bits*
            :bluebits *blue-bits*
            :alphabits *alpha-bits*
            :depthbits *depth-bits*
            :stencilbits *stencil-bits*
            :mode *display-mode*
)

     ...
)
· original author: Jax
>А что автор не учел?
В смысле автор Cityscape. Запустил его таки: