From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#11970: EIEIO accessors no longer work with setf in Emacs HEAD Date: Wed, 18 Jul 2012 03:20:26 -0400 Message-ID: References: <878vehdgag.fsf@gmx.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1342596070 16521 80.91.229.3 (18 Jul 2012 07:21:10 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 18 Jul 2012 07:21:10 +0000 (UTC) Cc: 11970@debbugs.gnu.org To: Eric Schulte Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 18 09:21:09 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SrOZI-0005kU-PX for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Jul 2012 09:21:09 +0200 Original-Received: from localhost ([::1]:55939 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrOZH-0003aZ-Ow for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Jul 2012 03:21:07 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrOZE-0003aR-Mw for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 03:21:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SrOZ8-0003jc-6W for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 03:21:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrOZ8-0003jM-2z for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 03:20:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SrOez-0005a3-K1 for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 03:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Jul 2012 07:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11970 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11970-submit@debbugs.gnu.org id=B11970.134259640021421 (code B ref 11970); Wed, 18 Jul 2012 07:27:01 +0000 Original-Received: (at 11970) by debbugs.gnu.org; 18 Jul 2012 07:26:40 +0000 Original-Received: from localhost ([127.0.0.1]:47289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SrOec-0005ZQ-Ui for submit@debbugs.gnu.org; Wed, 18 Jul 2012 03:26:39 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:60588) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SrOea-0005ZJ-9l for 11970@debbugs.gnu.org; Wed, 18 Jul 2012 03:26:37 -0400 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q6I7KSeH016940; Wed, 18 Jul 2012 03:20:29 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 37712AE59B; Wed, 18 Jul 2012 03:20:26 -0400 (EDT) In-Reply-To: <878vehdgag.fsf@gmx.com> (Eric Schulte's message of "Tue, 17 Jul 2012 19:11:35 -0600") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4282=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4282> : streams <786532> : uri <1168250> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:62080 Archived-At: > (defclass foo nil > ((bar :initarg :bar :accessor bar :initform nil))) [...] > (setf (bar *foo*) :quz) > ;; => (error "(bar *foo*) is not a valid place expression") Indeed, I had not noticed that eieio.el relied on cl-macs.el's internals for these. Should be fixed now, thank you. Stefan === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-07-18 05:44:36 +0000 +++ lisp/ChangeLog 2012-07-18 07:18:25 +0000 @@ -1,3 +1,8 @@ +2012-07-18 Stefan Monnier + + * emacs-lisp/eieio.el: Adapt further to gv.el (bug#11970). + (eieio-defclass): Use gv-define-setter when possible. + 2012-07-18 Dmitry Antipov Reflect recent changes in Fgarbage_collect. === modified file 'lisp/emacs-lisp/eieio.el' --- lisp/emacs-lisp/eieio.el 2012-07-13 07:06:09 +0000 +++ lisp/emacs-lisp/eieio.el 2012-07-18 07:10:56 +0000 @@ -44,8 +44,7 @@ ;;; Code: -(eval-when-compile - (require 'cl)) +(eval-when-compile (require 'cl)) ;FIXME: Use cl-lib! (defvar eieio-version "1.3" "Current version of EIEIO.") @@ -431,10 +430,10 @@ (run-hooks 'eieio-hook) (setq eieio-hook nil) - (if (not (symbolp cname)) (signal 'wrong-type-argument '(symbolp cname))) - (if (not (listp superclasses)) (signal 'wrong-type-argument '(listp superclasses))) + (if (not (listp superclasses)) + (signal 'wrong-type-argument '(listp superclasses))) - (let* ((pname (if superclasses superclasses nil)) + (let* ((pname superclasses) (newc (make-vector class-num-slots nil)) (oldc (when (class-p cname) (class-v cname))) (groups nil) ;; list of groups id'd from slots @@ -553,8 +552,8 @@ (put cname 'cl-deftype-handler (list 'lambda () `(list 'satisfies (quote ,csym))))) - ;; before adding new slots, let's add all the methods and classes - ;; in from the parent class + ;; Before adding new slots, let's add all the methods and classes + ;; in from the parent class. (eieio-copy-parents-into-subclass newc superclasses) ;; Store the new class vector definition into the symbol. We need to @@ -652,9 +651,9 @@ ;; We need to id the group, and store them in a group list attribute. (mapc (lambda (cg) (add-to-list 'groups cg)) customg) - ;; anyone can have an accessor function. This creates a function + ;; Anyone can have an accessor function. This creates a function ;; of the specified name, and also performs a `defsetf' if applicable - ;; so that users can `setf' the space returned by this function + ;; so that users can `setf' the space returned by this function. (if acces (progn (eieio--defmethod @@ -668,6 +667,13 @@ ;; Else - Some error? nil? nil))) + (if (fboundp 'gv-define-setter) + ;; FIXME: We should move more of eieio-defclass into the + ;; defclass macro so we don't have to use `eval' and require + ;; `gv' at run-time. + (eval `(gv-define-setter ,acces (eieio--store eieio--object) + (list 'eieio-oset eieio--object '',name + eieio--store))) ;; Provide a setf method. It would be cleaner to use ;; defsetf, but that would require CL at runtime. (put acces 'setf-method @@ -678,8 +684,9 @@ (list --widget-sym--) (list widget) (list --store-sym--) - (list 'eieio-oset --widget-sym-- '',name --store-sym--) - (list 'getfoo --widget-sym--))))))) + (list 'eieio-oset --widget-sym-- '',name + --store-sym--) + (list 'getfoo --widget-sym--)))))))) ;; If a writer is defined, then create a generic method of that ;; name whose purpose is to set the value of the slot. @@ -702,7 +709,8 @@ ) (setq slots (cdr slots))) - ;; Now that everything has been loaded up, all our lists are backwards! Fix that up now. + ;; Now that everything has been loaded up, all our lists are backwards! + ;; Fix that up now. (aset newc class-public-a (nreverse (aref newc class-public-a))) (aset newc class-public-d (nreverse (aref newc class-public-d))) (aset newc class-public-doc (nreverse (aref newc class-public-doc))) @@ -2544,11 +2552,14 @@ ;; (defsetf eieio-oref eieio-oset) -;; FIXME: Not needed for Emacs>=24.2 since setf follows function aliases. + +(if (eval-when-compile (fboundp 'gv-define-expander)) + ;; Not needed for Emacs>=24.2 since gv.el's setf expands macros and + ;; follows aliases. + nil (defsetf slot-value eieio-oset) ;; The below setf method was written by Arnd Kohrs -;; FIXME: Not needed for Emacs>=24.2 since setf expands macros. (define-setf-method oref (obj slot) (with-no-warnings (require 'cl) @@ -2560,7 +2571,7 @@ (list store-temp) (list 'set-slot-value obj-temp slot-temp store-temp) - (list 'slot-value obj-temp slot-temp))))) + (list 'slot-value obj-temp slot-temp)))))) ;;;