Discussion of Common Lisp
-
MurderThyLamb
- Posts: 2
- Joined: Thu Apr 10, 2014 7:01 pm
Post
by MurderThyLamb » Thu Apr 10, 2014 7:07 pm
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?
-
Goheeca
- Posts: 271
- Joined: Thu May 10, 2012 12:54 pm
-
Contact:
Post
by Goheeca » Sat Apr 12, 2014 4:36 am
The standard
admits only an optimize clause in defgeneric. And of course, the implementation-dependent clauses. It certainly isn't a standard clause.
-
edgar-rft
- Posts: 226
- Joined: Fri Aug 06, 2010 6:34 am
- Location: Germany
Post
by edgar-rft » Sat Apr 12, 2014 5:37 am
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.
-
MurderThyLamb
- Posts: 2
- Joined: Thu Apr 10, 2014 7:01 pm
Post
by MurderThyLamb » Mon Apr 14, 2014 11:47 pm
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.
-
macrolyte
- Posts: 40
- Joined: Sat Jan 25, 2014 8:56 pm
- Location: The wilderness of North America
Post
by macrolyte » Thu Apr 17, 2014 11:26 am
Open Genera Documentation :=>
Here.