From jdcal at yahoo.com Tue Aug 10 15:05:58 2004 From: jdcal at yahoo.com (Jeff Caldwell) Date: Tue, 10 Aug 2004 08:05:58 -0700 (PDT) Subject: [aspectl-devel] Errors in code from overview.html in aspectl-0.6 Message-ID: <20040810150558.25993.qmail@web50602.mail.yahoo.com> 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) ; => (# #) (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))) ; => # (with-class 'person (class-add :direct-slots '(age :accessor age :initarg :age))) ; => # (setq *p1* (make-instance 'person)) ; => # (inspect *p1*) ; => ; # is a PERSON ; NAME # ; ; 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)) ; => # (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))) ; => # (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)))) ; => # (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))) ; => # (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*) ; => (# # #) (print-person-list *pl*) ; Error: ; => Call (#) 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 From jdcal at yahoo.com Tue Aug 10 17:37:45 2004 From: jdcal at yahoo.com (Jeff Caldwell) Date: Tue, 10 Aug 2004 10:37:45 -0700 (PDT) Subject: [aspectl-devel] Some progress... Message-ID: <20040810173745.54865.qmail@web50603.mail.yahoo.com> Hi, I found my problems with most of the issues. What I still have not made work is: (with-class 'person (class-add :direct-slots '(age :accessor age :initarg :age))) The following fixes my first two errors: (defpackage test-aspectl (:use :aspectl :cl-user :cl)) (in-package :test-aspectl) (defvar *some-environment* "This is *some-environment*!") (defvar *env-depth* 0) (defun setup-env (environment) (declare (ignore environment)) (incf *env-depth*)) (defun teardown-env () (decf *env-depth*)) (defmacro with-some-environment ((environment) &body body) `(let ((*some-environment* (setup-env ,environment))) (unwind-protect , at body (teardown-env)))) (defmethod do-something (args &key &allow-other-keys) (format t "~&do-something *some-environment* ~A" *some-environment*)) (defmethod do-something-else (args &key &allow-other-keys) (format t "~&do-something-else *some-environment* ~A" *some-environment*)) (define-pointcut environment-pointcut) (define-join-point environment-pointcut do-something) (define-join-point environment-pointcut do-something-else) (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)))))) Tonight I will try to get over the "now what?" feeling ... now what do I do with the code above? :) It is now with-special-function-scope instead of overview.html's with-special-generic-function-scope: (with-special-function-scope (print-person*) (defmethod* print-person* :before ((scope dynamic) person) (print "Dynamic!")) (print-person-list *pl*)) "Dynamic!" "Mr. X" "Dynamic!" "Mr. Y" "Dynamic!" "Mr. Z" (print-person-list *pl*) "Mr. X" "Mr. Y" "Mr. Z" Jeff Caldwell __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail From costanza at web.de Tue Aug 10 18:59:11 2004 From: costanza at web.de (Pascal Costanza) Date: Tue, 10 Aug 2004 20:59:11 +0200 Subject: [aspectl-devel] Errors in code from overview.html in aspectl-0.6 In-Reply-To: <20040810150558.25993.qmail@web50602.mail.yahoo.com> References: <20040810150558.25993.qmail@web50602.mail.yahoo.com> Message-ID: <5D78690B-EAFF-11D8-BDEC-000A95DB189E@web.de> Hi Jeff, Thanks a lot for the bug report. Yes, I should have tested these things more carefully, but I have found the sources for these bugs. See the following responses. On 10 Aug 2004, at 17:05, Jeff Caldwell wrote: > (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) > ; => (# #) > > (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 Hm, it doesn't seem so. Maybe you have missed something during copy and paste? > ; > ; Error: > ; => Undefined function DO-SOMETHING-ELSE in form > ; (SYMBOL-FUNCTION DO-SOMETHING-ELSE) This cannot work. The example refers to the previous section where I have sketched methods do-something and do-something-else. Without those methods the code cannot work. Check out the sources of al-mixins.lisp for a more complete example. (I should provide a more illustrative example, this one is obviously too abstract.) > (defclass person () > ((name :accessor name :initarg :name))) > ; => # > > (with-class 'person > (class-add > :direct-slots > '(age :accessor age :initarg :age))) > ; => # > > (setq *p1* (make-instance 'person)) > ; => # > > (inspect *p1*) > ; => > ; # is a PERSON > ; NAME # > ; > ; Error: > ; The direct slot 'age' was not added to the class > ; 'person Yep. The bug is in al-mixins.lisp. See the aspect weaver WITH-CLASS ACCEPT-CLASS-ARG. There is a test (if (not (eq 'class *the-class*)) ...). This should read (if (not (eq ,class *the-class*)) ...). (A comma instead of a quote.) > (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))) > ; => # (T) 2068C044> My mistake. Instead of WITH-SPECIAL-GENERIC-FUNCTION-SCOPE this should read WITH-SPECIAL-FUNCTION-SCOPE. This is a leftover from 0.5. Thanks a lot. I am going to update the website soon. Pascal -- Tyler: "How's that working out for you?" Jack: "Great." Tyler: "Keep it up, then." From costanza at web.de Thu Aug 12 15:32:29 2004 From: costanza at web.de (Pascal Costanza) Date: Thu, 12 Aug 2004 17:32:29 +0200 Subject: [aspectl-devel] Some progress... In-Reply-To: <20040810173745.54865.qmail@web50603.mail.yahoo.com> References: <20040810173745.54865.qmail@web50603.mail.yahoo.com> Message-ID: On 10 Aug 2004, at 19:37, Jeff Caldwell wrote: > Tonight I will try to get over the "now what?" feeling > ... now what do I do with the code above? :) As I said before, the example in the overview section is somewhat abstract, to say the least. I am working on providing better and more illustrative examples. However, the essential idea of generic pointcuts is this: Whenever a number of different generic functions share common behavior that can be factored out in before/after/around methods, you can use the generic pointcuts to define all those before/after/around methods in one single place. The pointcut then takes care of applying them to all the specified generic functions. (That's what the call "quantification" in the AOSD community.) The advantage is that changes to such before/after/around methods can be made in one place instead of many and possibly distributed places. See my other reply for the bug that caused with-class to fail. Pascal -- Tyler: "How's that working out for you?" Jack: "Great." Tyler: "Keep it up, then." From costanza at web.de Mon Aug 16 21:43:57 2004 From: costanza at web.de (Pascal Costanza) Date: Mon, 16 Aug 2004 23:43:57 +0200 Subject: [aspectl-devel] AspectL paper Message-ID: <60610D2F-EFCD-11D8-9103-000A95DB189E@web.de> Hi, I am currently polishing a paper about AspectL that has been accepted for a workshop. If anyone is interested in reading it upfront, please contact me. In turn, I would be happy to get some additional feedback in order to improve the paper. All the best, Pascal -- Tyler: "How's that working out for you?" Jack: "Great." Tyler: "Keep it up, then."