[aspectl-devel] Errors in code from overview.html in aspectl-0.6

Jeff Caldwell jdcal at yahoo.com
Tue Aug 10 15:05:58 UTC 2004


Hi,

I used asdf to load aspectl-0.6. Using overview.html,
I extracted the code examples and tried to run them
under Lispworks for Windows Professional 4.3.7. I got
four errors. Here is my session:

;;;; Problems are noted in comments beginning 
;;;; with "Error:"


(defpackage test-aspectl 
  (:use :aspectl :cl-user :cl))
(in-package :test-aspectl)

(define-join-point environment-pointcut 
    do-something)
(define-join-point environment-pointcut 
    do-something-else)
; => (#<JOIN-PONT 216EEA1C> #<JOIN-PONT 2068D784>)

(define-aspect-weaver environment-pointcut
accept-environment-arg
    (aspect-weaver join-point)
  (declare (ignore aspect-weaver))
  (create-method
   (fdefinition (join-point-name join-point))
   :qualifiers '(:around)
   :lambda-list '(args &key (in-environment 
                                 *some-environment*)
                       &allow-other-keys)
   :specializers (list (find-class 't))
   :declarations '((ignore args))
   :body '(progn
            (if (eq in-environment *some-environment*)
                (call-next-method)
              (with-some-environment (in-environment)
                (call-next-method)))))))
; Error:
; The code from overview.html is missing 
;  a parenthesis on the last line
;
; Error:
; => Undefined function DO-SOMETHING-ELSE in form
;    (SYMBOL-FUNCTION DO-SOMETHING-ELSE)


(defclass person ()
  ((name :accessor name :initarg :name)))
; => #<STANDARD-CLASS PERSON 217ABAD4>

(with-class 'person
  (class-add
   :direct-slots
   '(age :accessor age :initarg :age)))
; => #<STANDARD-CLASS PERSON 217ABAD4>

(setq *p1* (make-instance 'person))
; => #<PERSON 20687C04>

(inspect *p1*)
; =>
; #<PERSON 211E92A4> is a PERSON
; NAME      #<unbound slot>
;
; Error:
; The direct slot 'age' was not added to the class 
;  'person

(defclass person ()
  ((name :accessor person-name :initarg :name 
         :special t))
  (:metaclass special-class))
; => #<SPECIAL-CLASS PERSON 217ABAD4>

(defvar *p* (make-instance 'person :name "Dr.
Jekyll"))
; => *P*

(dletf (((person-name *p*) "Mr. Hide"))
  (print (person-name *p*)))
; => "Mr. Hide"

(person-name *p*)
; => "Dr. Jekyll"

(defgeneric print-person-list (person-list)
  (:method (person-list)
   (mapc #'print-person person-list)))
; => #<STANDARD-GENERIC-FUNCTION 
        PRINT-PERSON-LIST 211DCDD2>

(define-special-function print-person (person)
  (:definer print-person*)
  ;; "print-person" is the name to use for
  ;; calling the function while "print-person*"
  ;; is the name to use for defining methods
  (:method ((scope t) person)
   (print (person-name person))))
; => #<SPECIAL-FUNCTION PRINT-PERSON* 211D9D2A>

(defmethod print-person-list :around (person-list)
  (with-special-generic-function-scope (print-person*)
    (defmethod* print-person* :before 
      ((scope dynamic) person)
      (print "This person is part of a person list."))
    (call-next-method)))
; => #<STANDARD-METHOD PRINT-PERSON-LIST (:AROUND) 
       (T) 2068C044>

(setq *pl* ())
(push (make-instance 'person :name "Mr. X") *pl*)
(push (make-instance 'person :name "Mr. Y") *pl*)
(push (make-instance 'person :name "Mr. Z") *pl*)
; => (#<PERSON 2066A5C4> #<PERSON 2069108C> #<PERSON
206883BC>)

(print-person-list *pl*)
; Error:
; => Call (#<closure 206642DA>) has the wrong 
;     number of arguments.


Jeff Caldwell


		
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail




More information about the Aspectl-devel mailing list