From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: pillule Newsgroups: gmane.emacs.help Subject: Re: EIEIO accessing class slots Date: Fri, 11 Jun 2021 04:52:46 +0200 Message-ID: <875yylnljs.fsf@riseup.net> References: <87eed9pwyi.fsf@riseup.net> <87mtrxnvp7.fsf@riseup.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25717"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 11 05:11:09 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrXZc-0006T9-HX for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 11 Jun 2021 05:11:08 +0200 Original-Received: from localhost ([::1]:52746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrXZa-0002E1-B5 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 10 Jun 2021 23:11:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrXZG-0002Dm-49 for help-gnu-emacs@gnu.org; Thu, 10 Jun 2021 23:10:46 -0400 Original-Received: from mx1.riseup.net ([198.252.153.129]:42694) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrXZE-0005ap-1x for help-gnu-emacs@gnu.org; Thu, 10 Jun 2021 23:10:45 -0400 Original-Received: from fews2.riseup.net (fews2-pn.riseup.net [10.0.1.84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Sectigo RSA Domain Validation Secure Server CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4G1QpB5gcqzDrk1; Thu, 10 Jun 2021 20:10:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1623381042; bh=vt9IhICXtMvXwwk3QKaQTGY8sFyqzhbZ92pJavuhOlY=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=Qc5+PKRxDKQlfzDhqpJeZQFq9VryTBbUbAqNirRPrBgTTq7Rg7/n/D2EzNIAzRLhq P3Q5JAx/mYQwZVQEX2r+nPdAOnacDOZNpQtT+ovNSLUPPR7xKyloUDiMTJ+i73PfvS BNlkRQ3zN60O3cUZgCxeoMW0/xf703aYFHCREzhE= X-Riseup-User-ID: 953751FEEB429B8A581CB8974370505C863651D076D0E83258491EDB7F39A9A4 Original-Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews2.riseup.net (Postfix) with ESMTPSA id 4G1Qp94gx5z1yjy; Thu, 10 Jun 2021 20:10:41 -0700 (PDT) In-reply-to: Received-SPF: pass client-ip=198.252.153.129; envelope-from=pillule@riseup.net; helo=mx1.riseup.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:130747 Archived-At: Stefan Monnier via Users list for the GNU Emacs text editor writes: >>>> How can I accede to the initarg of an eieio class? >>> What do you mean exactly by that and why do you need that? >> [description of your code] >> This need adjustments but I hope you get the idea. > > Sadly, this describes your code (with reference to unexplained things > like "the get-or-create of the object"), so no I don't understand what > you're doing at all, and I don't know what those values are > meant to hold, so I don't know what you mean to do. > > E.g. why do you do > > (oref-default 'moirai-dired-side :display-alist) > > instead of > > (oref-default 'moirai-dired-side 'display-alist) > > ? part of the confusion comes that oref already quote the slot, quoting it ag= ain results ''display-alist after macro-expansion. Not very much my taste t= o put confusion between values and symbols. The second part of the confusion is the EIEIO manual which show as exemple = in "(eieio) Quick Start" (defclass person () ; No superclasses ((name :initarg :name ;; <<< a :keyword as initarg ! :initform "" :type string :custom string :documentation "The name of a person.") (birthday :initarg :birthday :initform "Jan 1, 1970" :custom string :type string :documentation "The person's birthday.") (phone :initarg :phone :initform "" :documentation "Phone number.")) "A class for tracking people I know.") It uses keywords as :initarg so I followed the template to create my own me= thods and ended up with keywords as :initarg (also why showcasing :initarg = if it automatically set by defclass ?) It is empathized again in "(eieio) Slot Options" =E2=80=98:initarg=E2=80=99 A symbol that can be used in the argument list of the constructor to specify a value for this slot of the new instance being created. A good symbol to use for initarg is one that starts with a colon =E2=80=98:=E2=80=99. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The slot specified like this: (myslot :initarg :myslot) could then be initialized to the number 1 like this: (myobject :myslot 1) --