From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Pierre Lorenzon Newsgroups: gmane.emacs.help Subject: Re: EIEIO defmethod broken if symbol already bound? Date: Sun, 19 May 2013 11:45:37 +0200 (CEST) Message-ID: <20130519.114537.193724406.devel@pollock-nageoire.net> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1368957094 6311 80.91.229.3 (19 May 2013 09:51:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 19 May 2013 09:51:34 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: me@wilfred.me.uk Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 19 11:51:33 2013 Return-path: Envelope-to: geh-help-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 1Ue0H5-0005lu-KE for geh-help-gnu-emacs@m.gmane.org; Sun, 19 May 2013 11:51:31 +0200 Original-Received: from localhost ([::1]:33423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ue0H4-00065C-Vd for geh-help-gnu-emacs@m.gmane.org; Sun, 19 May 2013 05:51:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ue0Gr-00064w-FL for help-gnu-emacs@gnu.org; Sun, 19 May 2013 05:51:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ue0Gm-0002Wg-7u for help-gnu-emacs@gnu.org; Sun, 19 May 2013 05:51:17 -0400 Original-Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:29238 helo=smtp.smtpout.orange.fr) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ue0Gl-0002Vq-WA for help-gnu-emacs@gnu.org; Sun, 19 May 2013 05:51:12 -0400 Original-Received: from localhost ([90.24.148.135]) by mwinf5d29 with ME id dlr61l0052vWhbN03lr6kV; Sun, 19 May 2013 11:51:07 +0200 In-Reply-To: X-Mailer: Mew version 6.2.51 on Emacs 24.0.50 / Mule 6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.12.242.128 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:90918 Archived-At: Hi, In fact it is a question for cedet mailing lists. But I don't really understand what you want to do. I claim that it is not possible to define a method whose name is the name of an existing emacs method : (defun foo () ...) (defmethod foo () ...) Is not allowed. This is eieio policy. I suspect that (defalias foo ...) (defmethod foo ...) is not permitied as well. In fact I suspect that the defmethod macro or more certianly the defgeneric function will check the function field of the symbol 'foo and if that one is not empty or not set to something inheritable redefinition will be prohibited. If I don't make a mistake defalias will also set the function field of the symbol. The true mechanism is maybe a little bit more sophisticated by usage of obarrays and hash table but it works more or less as I said. Surely (defmethod foo ((s class_1)) (defmethod foo ((s class_2)) is allowed for inheritance (see usage of call-next-method for this purpose.) Regards Pierre From: Wilfred Hughes Subject: EIEIO defmethod broken if symbol already bound? Date: Sat, 18 May 2013 16:10:36 +0100 > Hi folks > > I think this might be an Emacs bug, but I'm not familiar enough with EIEIO > to be certain. Suppose I want to assign a method foo to a class some-class: > > (require 'eieio) > > (defclass some-class () > ((bar :initform 42))) > > (defmethod foo ((s some-class)) > 1) > > This works fine. However, if the function definition of foo is already > bound to t, it doesn't work: > > (require 'eieio) > > (defclass some-class () > ((bar :initform 42))) > > (defalias 'foo 't) > > (defmethod foo ((s some-class)) > 1) ;; Debugger entered--Lisp error: (void-function foo) > > I'm forced to set foo to a function (e.g. (defalias 'foo 'method)) before I > can use (defmethod foo ...). In fact, calling M-x describe-function > foo says 'file a bug report'. > > Now, I know that (defalias 'foo 't) is silly thing to do. However, I > accidentally ended up in this state when hacking on some code. > > Is this a legitimate bug? Emacs 24.2.1. > > Thanks :)