From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Semantics of :initform and oset-default Date: Sun, 08 Feb 2015 21:48:16 -0500 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423450108 31881 80.91.229.3 (9 Feb 2015 02:48:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 Feb 2015 02:48:28 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eric M. Ludlam Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 09 03:48:28 2015 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 1YKeOf-0004Re-Dy for ged-emacs-devel@m.gmane.org; Mon, 09 Feb 2015 03:48:25 +0100 Original-Received: from localhost ([::1]:58560 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKeOe-00015Z-Ob for ged-emacs-devel@m.gmane.org; Sun, 08 Feb 2015 21:48:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKeOb-00015F-2K for emacs-devel@gnu.org; Sun, 08 Feb 2015 21:48:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKeOX-0003Qo-Pf for emacs-devel@gnu.org; Sun, 08 Feb 2015 21:48:21 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:53079) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKeOX-0003Qk-MM; Sun, 08 Feb 2015 21:48:17 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApUUAPOG1lTAqyxp/2dsb2JhbABbgwYBg16FU7prhXoEAoEPRAEBAQEBAXyEaSNPJhgNJIhAziMsj3iEMQWKJ6EQIoQMIIJzAQEB X-IPAS-Result: ApUUAPOG1lTAqyxp/2dsb2JhbABbgwYBg16FU7prhXoEAoEPRAEBAQEBAXyEaSNPJhgNJIhAziMsj3iEMQWKJ6EQIoQMIIJzAQEB X-IronPort-AV: E=Sophos;i="5.09,536,1418101200"; d="scan'208";a="109990344" Original-Received: from 192-171-44-105.cpe.pppoe.ca (HELO pastel.home) ([192.171.44.105]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 Feb 2015 21:48:16 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 8F7C71F77; Sun, 8 Feb 2015 21:48:16 -0500 (EST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:182651 Archived-At: Hi Eric, I have some questions about the default values of object slots: - The Texinfo docs say: [...] The value passed to initform is automatically quoted. Thus, :initform (1 2 3) appears as the specified list in the default object. A symbol that [...] this seems to say that :initform is really an init*value*. But then in eieio-tests.el we have: (defclass inittest nil ((staticval :initform 1) (symval :initform eieio-test-permuting-value) (evalval :initform (symbol-value 'eieio-test-permuting-value)) (evalnow :initform (symbol-value 'eieio-test-permuting-value) :allocation :class) ) "Test initforms that eval.") (ert-deftest eieio-test-21-eval-at-construction-time () ;; initforms that need to be evalled at construction time. (setq eieio-test-permuting-value 2) (setq eitest-pvinit (inittest)) (should (eq (oref eitest-pvinit staticval) 1)) (should (eq (oref eitest-pvinit symval) 'eieio-test-permuting-value)) (should (eq (oref eitest-pvinit evalval) 2)) (should (eq (oref eitest-pvinit evalnow) 1))) which gives a different picture, and I don't really understand it: in the `symval' slot the :initform seems to be quoted (as documented), but in the other two (`evalval' and `evalnow') the :initforms are actually evaluated. - How is it supposed to interact with oset-default? Is the value passed to `oset-default' interpreted as a plain value (to which the slot will always be initialized), or is it interpreted as a "maybe value maybe expression to be evaluated", like the :initform? Stefan