From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.help Subject: Re: eieio defclass evaluate :initform value Date: Wed, 04 Jan 2017 12:45:22 -0800 Message-ID: <87o9zm7dwd.fsf@ericabrahamsen.net> References: <20170104120403.6e7c67e8@gauss> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1483564056 11328 195.159.176.226 (4 Jan 2017 21:07:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 4 Jan 2017 21:07:36 +0000 (UTC) User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/26.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 04 22:07:33 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOsmO-000201-LP for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Jan 2017 22:07:28 +0100 Original-Received: from localhost ([::1]:42161 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOsmS-0007ql-Ps for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Jan 2017 16:07:32 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOsRN-0006yU-Cc for help-gnu-emacs@gnu.org; Wed, 04 Jan 2017 15:45:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOsRK-0003py-3m for help-gnu-emacs@gnu.org; Wed, 04 Jan 2017 15:45:45 -0500 Original-Received: from [195.159.176.226] (port=60149 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cOsRJ-0003oX-Ry for help-gnu-emacs@gnu.org; Wed, 04 Jan 2017 15:45:42 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cOsR5-0004hE-TF for help-gnu-emacs@gnu.org; Wed, 04 Jan 2017 21:45:27 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 24 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:kLKZKGpONlgn5GWmI1zFSQC71oQ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-Mailman-Approved-At: Wed, 04 Jan 2017 16:07:06 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:112049 Archived-At: Joe Riel writes: > According to the info page for eieio for Emacs 23, one > could do > > (defclass foo-class > ((bar :initform (lambda () my-var) > :type string))) > > When make-instance was called, the lambda expression > for :initform would be evaluated and the expression > assigned to my-var would be used for the slot bar. > > The info page for eieio Emacs 24 does not mention this > functionality and testing shows it no longer exists. > > Is there nice way, in 24, to create a class with an :initform > that, upon instantiation, evaluates to the value of a variable? Depending on what exactly you want, you might be able to solve it with `oset-default', which lives outside the class definition, and can evaluate variables. See if that does what you want? Eric