DEFGENERIC with DECLARE statements?

Discussion of Common Lisp

DEFGENERIC with DECLARE statements?

Postby 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?
MurderThyLamb
 
Posts: 2
Joined: Thu Apr 10, 2014 7:01 pm

Re: DEFGENERIC with DECLARE statements?

Postby 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.
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version).
User avatar
Goheeca
 
Posts: 205
Joined: Thu May 10, 2012 12:54 pm

Re: DEFGENERIC with DECLARE statements?

Postby 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.
edgar-rft
 
Posts: 155
Joined: Fri Aug 06, 2010 6:34 am
Location: Germany

Re: DEFGENERIC with DECLARE statements?

Postby 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.
MurderThyLamb
 
Posts: 2
Joined: Thu Apr 10, 2014 7:01 pm

Re: DEFGENERIC with DECLARE statements?

Postby macrolyte » Thu Apr 17, 2014 11:26 am

Open Genera Documentation :=>Here.
macrolyte
 
Posts: 40
Joined: Sat Jan 25, 2014 8:56 pm
Location: The wilderness of North America


Return to Common Lisp

Who is online

Users browsing this forum: No registered users and 3 guests

cron