[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
spurious "defined twice" msgs
- To: commonloops.pa@Xerox.COM
- Subject: spurious "defined twice" msgs
- From: esrig%oravax@wrath.cs.cornell.edu (Bruce Esrig)
- Date: Tue, 21 Feb 89 16:08:43 EST
- Redistributed: commonloops.pa
We are using PCL in conjunction with our own macro-based language extensions
which may be causing confusion. The code described below runs fine but
there are unexpected messages at compile time.
We often get a message reporting a function defined twice in a file.
Is this an essential feature of PCL or is it avoidable ?
We are using 8/28/88 (beta rev 1) AAAI PCL under Lucid 3.0.1 and Genera 7.1.
As an example, on the Symbolics we get:
For Function (PCL:METHOD TREEPRINT (STRING))
Function (PCL:METHOD TREEPRINT (STRING)) is defined twice in the file UL1:>...
The code contains a number of method definitions for treeprint.
For example,
(defclass primitive_constant (...)
((p_constant :accessor p_constant ... )) )
(defclass binder_name_or_index (...)
((isl ... )) )
(defmethod treeprint ((x string))
(princ x))
(defmethod treeprint ((prim_constant_term primitive_constant))
(case (p_constant prim_constant_term)
('all ...) ... ))
(defmethod-pattern treeprint ((x binder_name_or_index))
(pattern-let x
(((binder_name_or_index isl ...)) ...) ))
The defmethod-pattern expression is a macro which expands to a defmethod via
(defmacro defmethod-pattern (m args &rest forms)
`(lisp_plus_eval ( defmethod ,m ,args ,@forms)) )
(defmacro lisp_plus_eval (S-exp)
(let ((code (lisp_plus_translate S-exp)))
`,code) )
where lisp_plus_translate is a function defined using defun.
Lisp_plus_translate is a function from lisp forms to lisp forms which
respects the word defmethod, respects the name of the fn, respects the arguments,
and reads through the remaining forms to find places where make-instance calls
are specified or recursive analysis using the pattern-let keyword is performed.
The make-instance calls and pattern-let constructs are expanded in suitable ways
and the function returns the form as a whole, starting with '(defmethod ...).
Bruce Esrig
Odyssey Research Associates
esrig%oravax.uucp@cu-arpa.cs.cornell.edu