From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Raffaele Ricciardi Newsgroups: gmane.emacs.help Subject: EIEIO: how to validate a new instance? Date: Thu, 02 Aug 2012 17:29:42 +0100 Message-ID: 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: dough.gmane.org 1343921418 16303 80.91.229.3 (2 Aug 2012 15:30:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 2 Aug 2012 15:30:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 02 17:30:17 2012 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 1SwxLp-0005Ru-Fo for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Aug 2012 17:30:13 +0200 Original-Received: from localhost ([::1]:47763 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwxLo-0003xi-PB for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Aug 2012 11:30:12 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 36 Original-X-Trace: individual.net NAzfWIPbj2/LIA9F0ziiiAQNB8k3yH1HCCUJwCyUUTKqnqHXZ0rtwVXhGZJGUhH/HH Cancel-Lock: sha1:iM8v9eV+zhjbOOz/hbJiQ6VNyyc= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120713 Thunderbird/14.0 Original-Xref: usenet.stanford.edu gnu.emacs.help:193785 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:86157 Archived-At: Hello everyone, I need to create a new EIEIO object, but not all values are acceptable as initargs. My understanding is that I should use initialize-instance for checks, but I can't find the proper incantation to make it work (I even managed to make Emacs crash). Here is a sample code: (require 'eieio) (defclass my-class () ((x :initarg :x :type string ))) So far, so good. I can instantiate my class: (setq ^c (my-class "my-class" :x "x")) Here is one of my attempts at initialize-instance: (defun initialize-instance ((^c my-class) ^args) nil) It doesn't work: now I can't instantiate my class anymore: (setq ^c (my-class "my-class" :x "x")) Fails with: > Debugger entered--Lisp error: (invalid-function (lambda ((^y my-class) ^args) nil)) > initialize-instance([object my-class "my-class" unbound] (:x "x")) Any help? Thank you.