From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: change in call-next-method Date: Sun, 03 Jan 2016 12:05:29 -0600 Message-ID: <868u46bkt2.fsf@stephe-leake.org> References: <86poxiki76.fsf@stephe-leake.org> <874meudg0c.fsf@igel.home> <86d1tibwyb.fsf@stephe-leake.org> <87fuyesoqt.fsf@ericabrahamsen.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1451844387 12952 80.91.229.3 (3 Jan 2016 18:06:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Jan 2016 18:06:27 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eric Abrahamsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 03 19:06:17 2016 Return-path: Envelope-to: ged-emacs-devel@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 1aFn2m-0006hg-GM for ged-emacs-devel@m.gmane.org; Sun, 03 Jan 2016 19:06:16 +0100 Original-Received: from localhost ([::1]:42450 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFn2l-00041t-O7 for ged-emacs-devel@m.gmane.org; Sun, 03 Jan 2016 13:06:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFn2a-00041o-30 for emacs-devel@gnu.org; Sun, 03 Jan 2016 13:06:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aFn2W-0003NI-S9 for emacs-devel@gnu.org; Sun, 03 Jan 2016 13:06:04 -0500 Original-Received: from gproxy8-pub.mail.unifiedlayer.com ([67.222.33.93]:42380) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1aFn2W-0003NC-LG for emacs-devel@gnu.org; Sun, 03 Jan 2016 13:06:00 -0500 Original-Received: (qmail 30106 invoked by uid 0); 3 Jan 2016 18:05:55 -0000 Original-Received: from unknown (HELO cmgw3) (10.0.90.84) by gproxy8.mail.unifiedlayer.com with SMTP; 3 Jan 2016 18:05:55 -0000 Original-Received: from host114.hostmonster.com ([74.220.207.114]) by cmgw3 with id 1d5i1s00X2UdiVW01d5l5i; Sun, 03 Jan 2016 18:05:52 -0700 X-Authority-Analysis: v=2.1 cv=bej4Do/B c=1 sm=1 tr=0 a=CQdxDb2CKd3SRg4I0/XZPQ==:117 a=CQdxDb2CKd3SRg4I0/XZPQ==:17 a=DsvgjBjRAAAA:8 a=f5113yIGAAAA:8 a=9i_RQKNPAAAA:8 a=hEr_IkYJT6EA:10 a=x_XPkuGwIRMA:10 a=7aQ_Q-yQQ-AA:10 a=qbX9SruPAAAA:8 a=tBb2bbeoAAAA:8 a=CrGSG2nEDxYQfj6FESgA:9 a=_HyRrjxESAzgjMM0:21 a=cVcUYe5XHMa-WS_y:21 Original-Received: from [76.218.37.33] (port=64444 helo=TAKVER2) by host114.hostmonster.com with esmtpa (Exim 4.84) (envelope-from ) id 1aFn2G-00005L-QP; Sun, 03 Jan 2016 11:05:44 -0700 In-Reply-To: <87fuyesoqt.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sun, 03 Jan 2016 22:48:26 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt) X-Identified-User: {2442:host114.hostmonster.com:stephele:stephe-leake.org} {sentby:smtp auth 76.218.37.33 authed with stephen_leake@stephe-leake.org} X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 67.222.33.93 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:197477 Archived-At: Eric Abrahamsen writes: > Stephen Leake writes: > >> Andreas Schwab writes: >> >>> Stephen Leake writes: >>> >>>> I'm updating JDEE to Emacs 25. It has several functions like this: >>>> >>>> (cl-defmethod initialize-instance ((this jdee-jddocset) &rest rest) >>>> (apply 'call-next-method rest) >>>> (unless (oref this description) >>>> (oset this :description >>>> (if (oref this jdkp) >>>> (format "JDK %s Javadoc" (oref this version)) >>>> (let ((file (jdee-url-file (oref this url)))) >>>> (if (string-match ".*\\/\\(.*?\\)\\/doc\\/api" file) >>>> (match-string 1 file) >>>> (jdee-url-name (oref this url)))))))) >>>> >>>> This breaks if I just change call-next-method to cl-call-next-method. >>> >>> How do you change it? >> >> I tried: >> >> (apply 'cl-call-next-method rest) >> (cl-call-next-method rest) >> >> They both give the error: >> >> cl-call-next-method: cl-call-next-method only allowed inside primary and around methods >> >>> I think you are supposed to call it as >>> (cl-call-next-method). >> >> That gives the same error. >> >> Note that I don't actually need to call the superclass init; I just need >> to process the args in `rest', storing them in the slots. > > I think if you replace any of the args, you need to replace *all* of the > args. Ie, either: > > (cl-call-next-method) ; in which case your changes to REST are ignored > > or > > (cl-call-next-method this rest) > > Otherwise, it's just the wrong number of arguments. Same error. > I may be missing something, but... I think this error is due to trying to call the parent method, when there isn't one: (defclass jdee-jddocset () ... ) In Emacs 24.5, that calls the default superclass method. Apparently that call doesn't work properly in Emacs 25. There is an initialize-instance defined for the default superclass; in eieio.el: (cl-defmethod initialize-instance ((this eieio-default-superclass) &optional slots) "Construct the new object THIS based on SLOTS. SLOTS is a tagged list where odd numbered elements are tags, and even numbered elements are the values to store in the tagged slot. If you overload the `initialize-instance', there you will need to call `shared-initialize' yourself, or you can call `call-next-method' to have this constructor called automatically. If these steps are not taken, then new objects of your class will not have their values dynamically set from SLOTS." ;; First, see if any of our defaults are `lambda', and ;; re-evaluate them and apply the value to our slots. (let* ((this-class (eieio--object-class this)) (slots (eieio--class-slots this-class))) (dotimes (i (length slots)) ;; For each slot, see if we need to evaluate it. ;; ;; Paul Landes said in an email: ;; > CL evaluates it if it can, and otherwise, leaves it as ;; > the quoted thing as you already have. This is by the ;; > Sonya E. Keene book and other things I've look at on the ;; > web. (let* ((slot (aref slots i)) (initform (cl--slot-descriptor-initform slot)) (dflt (eieio-default-eval-maybe initform))) (when (not (eq dflt initform)) ;; FIXME: We should be able to just do (aset this (+ i ) dflt)! (eieio-oset this (cl--slot-descriptor-name slot) dflt))))) ;; Shared initialize will parse our slots for us. (shared-initialize this slots)) That seems to be the code I'm looking for. Maybe with this clue I can figure out why the call fails. -- -- Stephe