From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.user Subject: Re: Goops: Setting Immutible Classes? Date: Fri, 06 Oct 2017 02:24:56 -0400 Message-ID: <87wp48ztc7.fsf@netris.org> References: <1507269654.28034.8.camel@qlfiles.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1507271172 14320 195.159.176.226 (6 Oct 2017 06:26:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 6 Oct 2017 06:26:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Cc: Guile User Mailing List To: Christopher Howard Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Oct 06 08:26:08 2017 Return-path: Envelope-to: guile-user@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 1e0M5G-0002ln-DU for guile-user@m.gmane.org; Fri, 06 Oct 2017 08:26:06 +0200 Original-Received: from localhost ([::1]:43190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0M5N-0007ZO-E4 for guile-user@m.gmane.org; Fri, 06 Oct 2017 02:26:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0M4r-0007Xz-Oz for guile-user@gnu.org; Fri, 06 Oct 2017 02:25:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e0M4o-0007VG-JP for guile-user@gnu.org; Fri, 06 Oct 2017 02:25:41 -0400 Original-Received: from world.peace.net ([50.252.239.5]:34920) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e0M4o-0007Qv-Fk for guile-user@gnu.org; Fri, 06 Oct 2017 02:25:38 -0400 Original-Received: from pool-72-93-34-97.bstnma.east.verizon.net ([72.93.34.97] helo=jojen) by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e0M4b-0007g3-1n; Fri, 06 Oct 2017 02:25:27 -0400 In-Reply-To: <1507269654.28034.8.camel@qlfiles.net> (Christopher Howard's message of "Thu, 05 Oct 2017 22:00:54 -0800") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 50.252.239.5 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:14190 Archived-At: Christopher Howard writes: > Hi, is the a way I could use goops such that I the classes are non- > mutating, but have setters that simply return a new instance of the > class (instead of modifying the original)? We provide such a mechanism for SRFI-9 Records. Search for "Functional Setters" in section 6.6.16 (SRFI-9 Records) of the Guile manual. > I suppose I could simply use define-method to create setter methods > which create a new instance of the object; but that would get rather > complicated, wouldn't it, if the object had superclasses? So I need > some kind of shallow copy mechanism for the whole object, or a chained > copy mechanism...? For GOOPS classes, take a look at the built-in 'shallow-clone' generic function. It is described in section 8.10 (GOOPS Object Miscellany). Mark