Page 1 of 1

DEFGENERIC with DECLARE statements?

PostPosted: Thu Apr 10, 2014 7:07 pm
by MurderThyLamb
I was looking through some of the code for Open Genera, and I came across something I've never seen before:

Code: Select all
(defgeneric console-function-keys-enabled (console)
  (declare (values (or boolean (list character)))))
(defgeneric console-function-key-enabled-p (console &optional ch)
  (declare (values enabled)))
(defgeneric console-select-keys-enabled (console)
  (declare (values (or boolean (list character)))))
(defgeneric console-select-key-enabled-p (console &optional ch)
  (declare (values enabled)))
(defgeneric console-system-menu-enabled (console)
  (declare (values enabled)))


I compiled these and they work just fine, but I am completely unsure of what the effect is. Can anyone tell me how these particular DECLARE statements work inside of a DEFGENERIC?

Re: DEFGENERIC with DECLARE statements?

PostPosted: Sat Apr 12, 2014 4:36 am
by Goheeca
The standard admits only an optimize clause in defgeneric. And of course, the implementation-dependent clauses. It certainly isn't a standard clause.

Re: DEFGENERIC with DECLARE statements?

PostPosted: Sat Apr 12, 2014 5:37 am
by edgar-rft
Genera originally was written in Lisp Machine Lisp, where the Lisp Machine Manual, Section 3.5 Declarations says:

Lisp Machine Manual wrote:(values . values) or (:return-list . values)
Records values as the return values list of the function, to be used if anyone asks what values it returns. This is purely documentation.

Re: DEFGENERIC with DECLARE statements?

PostPosted: Mon Apr 14, 2014 11:47 pm
by MurderThyLamb
Thank you, that certainly cleared it up. The fact that it still compiles in Common Lisp (at least Clozure CL) is interesting, I'll have to check for any side effects. Could be slightly useful for documentation, like you pointed out.

Re: DEFGENERIC with DECLARE statements?

PostPosted: Thu Apr 17, 2014 11:26 am
by macrolyte
Open Genera Documentation :=>Here.