From: Raffaele Ricciardi <rfflrccrd@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: EIEIO: how to validate a new instance?
Date: Thu, 02 Aug 2012 17:29:42 +0100 [thread overview]
Message-ID: <a7vkm9F28uU1@mid.individual.net> (raw)
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.
next reply other threads:[~2012-08-02 16:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-02 16:29 Raffaele Ricciardi [this message]
2012-08-02 15:46 ` EIEIO: how to validate a new instance? David Engster
2012-08-02 16:40 ` Raffaele Ricciardi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a7vkm9F28uU1@mid.individual.net \
--to=rfflrccrd@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.