From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Eric M. Ludlam" Newsgroups: gmane.emacs.devel Subject: Re: EIEIO with lexical scoping Date: Mon, 13 May 2013 20:00:33 -0400 Message-ID: <51917EA1.50403@siege-engine.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1368489652 2001 80.91.229.3 (14 May 2013 00:00:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 14 May 2013 00:00:52 +0000 (UTC) Cc: "Eric M. Ludlam" , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 14 02:00:50 2013 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 1Uc2fi-0002FW-KL for ged-emacs-devel@m.gmane.org; Tue, 14 May 2013 02:00:50 +0200 Original-Received: from localhost ([::1]:56686 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uc2fh-0004dD-Ji for ged-emacs-devel@m.gmane.org; Mon, 13 May 2013 20:00:49 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uc2fa-0004d2-Mq for emacs-devel@gnu.org; Mon, 13 May 2013 20:00:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uc2fY-0003U8-1Y for emacs-devel@gnu.org; Mon, 13 May 2013 20:00:42 -0400 Original-Received: from mail-ve0-x22e.google.com ([2607:f8b0:400c:c01::22e]:33130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uc2fV-0003So-Jp; Mon, 13 May 2013 20:00:37 -0400 Original-Received: by mail-ve0-f174.google.com with SMTP id db10so518304veb.19 for ; Mon, 13 May 2013 17:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=znxvRT13ufnMctRIINcZd7SoKAjzxfPmEinxKz1AY0k=; b=xKs5707dt4Bqdu+yE+a38uV8UHnE34gOuPsJLMwEP/LVkQKQ+ryut8cgrvBPkUCFYH 8XGgvBozG0CYE7k+ZIZ6iItq9J4J4J0pFZPUkWG/gg2hhJbbdeVqn2u9OgMrQH/tPgWc oJdZovGJ+iECL24GB3dbyXbGUjafa9H3NoXYW03iRL5/7yp43G5lkACejaWpMPnwCpON HEdaHcLlyVHlA2D6tqFUjIDUUdeforSv39LpH+DhzCtg/XY53Z9+Dujr80yf0fKXYf9t d952iDzritsmAsGol/SvhCBhT//qCPrM2Ux+r+BcH7Hgc0qivkYyOW0GgVfiqtfj9ljF tAvg== X-Received: by 10.220.253.8 with SMTP id my8mr20315356vcb.23.1368489636389; Mon, 13 May 2013 17:00:36 -0700 (PDT) Original-Received: from [192.168.1.201] (pool-72-74-140-235.bstnma.fios.verizon.net. [72.74.140.235]) by mx.google.com with ESMTPSA id l6sm15103540vdh.3.2013.05.13.17.00.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 May 2013 17:00:35 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.3a1pre) Gecko/20091222 Shredder/3.1a1pre In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400c:c01::22e 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:159554 Archived-At: On 05/13/2013 05:25 PM, Stefan Monnier wrote: > I'm trying to compile eieio.el using lexical-binding but am bumping into > a problem that requires too much internal knowledge of eieio for me. > > I'm using the patch appended below for now, which seems to work to some > extent, but when I then try to compile CEDET using it, I get the > following backtrace: > > Can you help me figure out what's going on? > Sure, I'll be glad to help, though I don't know much about the lexical binding feature. I do know someone posted on the cedet-devel mailing list saying that EIEIO's use of 'scoped-class' broke lexical-binding. I'd been thinking about converting to use a stack instead of locally rebinding the value but hadn't gotten that far. > Debugger entered--Lisp error: (invalid-slot-name "#" tables) > signal(invalid-slot-name ("#" tables)) > eieio-default-superclass([object semanticdb-project-database default-cache-object unbound semanticdb-table nil nil] tables oref-default) > apply(eieio-default-superclass ([object semanticdb-project-database default-cache-object unbound semanticdb-table nil nil] tables oref-default)) > eieio-generic-call-primary-only(slot-missing ([object semanticdb-project-database default-cache-object unbound semanticdb-table nil nil] tables oref-default)) > slot-missing([object semanticdb-project-database default-cache-object unbound semanticdb-table nil nil] tables oref-default) > eieio-oref-default([object semanticdb-project-database default-cache-object unbound semanticdb-table nil nil] tables) > eieio-set-defaults([object semanticdb-project-database default-cache-object unbound semanticdb-table nil nil] t) The code around here looks like this: (let ((eieio-skip-typecheck t)) ;; All type-checking has been done to our satisfaction ;; before this call. Don't waste our time in this call.. (eieio-set-defaults cache t)) I'm not that familiar with lexical-binding, but I suspect this won't work... right? I didn't see this in your patch. Of course, it also doesn't have anything to do with the error either. A quick search shows that the method invocation has a similar pattern with 'eieiomt-optimizing-obarray' in 'eieio-generic-form' as well as use of 'scoped-class' in 'shared-initialize'. I would look at these first. I don't have line numbers since I think we are using different flavors of EIEIO. (see below.) > eieio-defclass(semanticdb-project-database (eieio-instance-tracker) ((tracking-symbol :initform semanticdb-database-list) (reference-directory :type string :documentation "Directory this database refers to.\nWhen a cache directory is specified, then this refers to the directory\nthis database contains symbols for.") (new-table-class :initform semanticdb-table :type class :documentation "New tables created for this database are of this class.") (cache :type list :initform nil :documentation "List of cache information for tools.\nAny particular tool can cache data to a database at runtime\nwith `semanticdb-cache-get'.\n\nUsing a semanticdb cache does not save any information to a file,\nso your cache will need to be recalculated at runtime.\n\nNote: This index will not be saved in a per sistent file.") (tables :initarg :tables :type semanticdb-abstract-table-list :accessor semanticdb-get-database-tables :protection :protected :documentation "List of `semantic-db-table' obje cts.")) ("Database of file tables.")) > (progn (eieio-defclass 'semanticdb-project-database '(eieio-instance-tracker) '((tracking-symbol :initform semanticdb-database-list) (reference-directory :type string :documentation "Directory this database refers to.\nWhen a cache directory is specified, then this refers to the directory\nthis database contains symbols for.") (new-table-class :initform semanticdb-table :type class :documentation "New tables created for this database are of this class.") (cache :type list :initform nil :documentation "List of cache information for tools.\nAny particular tool can cache data to a database at runtime\nwith `semanticdb-cache-get'.\n\nUsing a semanticdb cache does not save any information to a file,\nso your cache will need to be recalculated at runtime.\n\nNote: This index will not be sav ed in a persistent file.") (tables :initarg :tables :type semanticdb-abstract-table-list :accessor semanticdb-get-database-tables :protection :protected :documentation "List of `semantic-db- table' objects.")) '("Database of file tables."))) > eval((progn (eieio-defclass 'semanticdb-project-database '(eieio-instance-tracker) '((tracking-symbol :initform semanticdb-database-list) (reference-directory :type string :documentation "Directory this database refers to.\nWhen a cache directory is specified, then this refers to the directory\nthis database contains symbols for.") (new-table-class :initform semanticdb-table :type class :documentation "New tables created for this database are of this class.") (cache :type list :initform nil :documentation "List of cache information for tools.\nAny particular tool can cache data to a database at runtime\nwith `semanticdb-cache-get'.\n\nUsing a semanticdb cache does not save any information to a file,\nso your cache will need to be recalculated at runtime.\n\nNote: This index will not b e saved in a persistent file.") (tables :initarg :tables :type semanticdb-abstract-table-list :accessor semanticdb-get-database-tables :protection :protected :documentation "List of `semanti c-db-table' objects.")) '("Database of file tables."))) nil) > #[128 "\301\302\303B\"D\207" [lexical-binding quote eval progn] 5 "\n\n(fn&rest BODY)"]((eieio-defclass 'semanticdb-project-database '(eieio-instance-tracker) '((tracking-symbol :initform semanticdb-database-list) (reference-directory :type string :documentation "Directory this database refers to.\nWhen a cache directory is specified, then this refers to the directory\nthis database contains symbols for.") (new-table-class :initform semanticdb-table :type class :documentation "New tables created for this database are of this class.") (cache :type list :initform nil :documentation "List of cache information for tools.\nAny particular tool can cache data to a database at runtime\nwith `semanticdb-cache-get'.\n\nUsing a semanticdb cache does not save any information to a file,\nso your cache will need to be recalculated at runtime.\n\nNote: This index will not be saved in a persistent file.") (tables :initarg :tables :type semanticdb-abstract-table-list :accessor semanticd b-get-database-tables :protection :protected :documentation "List of `semantic-db-table' objects.")) '("Database of file tables."))) > (eval-and-compile (eieio-defclass 'semanticdb-project-database '(eieio-instance-tracker) '((tracking-symbol :initform semanticdb-database-list) (reference-directory :type string :documentation "Directory this database refers to.\nWhen a cache directory is specified, then this refers to the directory\nthis database contains symbols for.") (new-table-class :initform semanticdb-table :type class :documentation "New tables created for this database are of this class.") (cache :type list :initform nil :documentation "List of cache information for tools.\nAny particular tool can cache data to a database at runtime\nwith `semanticdb-cache-get'.\n\nUsing a semanticdb cache does not save any information to a file,\nso your cache will need to be recalculated at runtime.\n\nNote: This index will not be saved in a persistent file.") (tables :initarg :tables :type semanticdb-abstract-table-list :accessor semanticdb-get-database-tables :protection :protected :documentation "List of `s emantic-db-table' objects.")) '("Database of file tables."))) Note here: ^^^^ You are using a version of eieio that still uses eval-and-compile. I flushed the remaining uses of eval-and-compile from EIEIO in March in the CEDET repository due to a previous thread. I thought I had shared this change or it was merged upstream, but maybe I forgot? I apologize if you didn't get the update. The changes were extensive as half of EIEIO moved into a second file to help with compilation. It would be better of we both worked from there. Papers are all up to date if you want to pull that change from the CEDET repository. > (defclass semanticdb-project-database (eieio-instance-tracker) ((tracking-symbol :initform semanticdb-database-list) (reference-directory :type string :documentation "Directory this database refers to.\nWhen a cache directory is specified, then this refers to the directory\nthis database contains symbols for.") (new-table-class :initform semanticdb-table :type class :documentation "New tables created for this database are of this class.") (cache :type list :initform nil :documentation "List of cache information for tools.\nAny particular tool can cache data to a database at runtime\nwith `semanticdb-cache-get'.\n\nUsing a semanticdb cache does not save any information to a file,\nso your cache will need to be recalculated at runtime.\n\nNote: This index will not be saved in a persiste nt file.") (tables :initarg :tables :type semanticdb-abstract-table-list :accessor semanticdb-get-database-tables :protection :protected :documentation "List of `semantic-db-table' objects." )) "Database of file tables.") [snip] I have a two random questions below. > === modified file 'lisp/emacs-lisp/eieio.el' > --- lisp/emacs-lisp/eieio.el 2013-02-27 04:09:50 +0000 > +++ lisp/emacs-lisp/eieio.el 2013-05-13 21:22:02 +0000 > @@ -1,4 +1,4 @@ > -;;; eieio.el --- Enhanced Implementation of Emacs Interpreted Objects > +;;; eieio.el --- Enhanced Implementation of Emacs Interpreted Objects -*- lexical-binding:t -*- > ;;; or maybe Eric's Implementation of Emacs Interpreted Objects > > ;; Copyright (C) 1995-1996, 1998-2013 Free Software Foundation, Inc. > @@ -193,32 +193,31 @@ > ;; No check: If eieio gets this far, it's probably been checked already. > `(get ,class 'eieio-class-definition)) > > -(defmacro class-p (class) > +(defsubst class-p (class) Is this generic cleanup, or important for a lexical binding? > @@ -501,7 +500,7 @@ > (setf (eieio--class-children (class-v (car pname))) > (cons cname (eieio--class-children (class-v (car pname)))))) > ;; Get custom groups, and store them into our local copy. > - (mapc (lambda (g) (add-to-list 'groups g)) > + (mapc (lambda (g) (pushnew g groups :test #'equal)) Similar question. Is add-to-list bad for lexical binding? Thanks Eric