From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mikael Djurfeldt Newsgroups: gmane.lisp.guile.user Subject: Re: GOOPS question Date: Fri, 30 Apr 2021 12:43:30 +0200 Message-ID: References: Reply-To: mikael@djurfeldt.com 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="31656"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user To: Damien Mattei Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Apr 30 13:10:47 2021 Return-path: Envelope-to: guile-user@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 1lcR2l-00087p-6U for guile-user@m.gmane-mx.org; Fri, 30 Apr 2021 13:10:47 +0200 Original-Received: from localhost ([::1]:33156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcR2k-0004oG-3i for guile-user@m.gmane-mx.org; Fri, 30 Apr 2021 07:10:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcQcb-0001h0-Et for guile-user@gnu.org; Fri, 30 Apr 2021 06:43:45 -0400 Original-Received: from mail-vk1-f173.google.com ([209.85.221.173]:40657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcQcY-0005y0-Vv for guile-user@gnu.org; Fri, 30 Apr 2021 06:43:45 -0400 Original-Received: by mail-vk1-f173.google.com with SMTP id v3so6897976vkn.7 for ; Fri, 30 Apr 2021 03:43:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=xlAnvSY19UWZeaz2dgp4/U62B7BCcPqeMlII8c9oHx4=; b=kEZYLi/qUqs5WoEfTSYMCY7Bgf28jrYM/WzqK4MIeo094THNYSmhoIPPtI/Xp+BDUo /ATAAc9KGzfCI/SqUMFQ5q7wPTVHQGK0FR9xE4vYFwC19lnG5DG2ZWbxknzqUvhXKW4f seVgIUFe5GStrSjSvY9sz1DvMo4XfEGFTPdzPyOM3GIel0oBKK4Vi9/KrR4sTD/w2vkQ yY92qrQTPX7dAEnjw3swHj4cIYgoMnaJqMlPrRpDe0A+vA8nW8VXUA1kr7qm+NQUDt7Y zxrJ7nO2ndN1w6DpU/1v2pJJsIjCstFdq2F4nDY+4TVuzQJF1TqyVU79BrxKmsavmEIK VfJA== X-Gm-Message-State: AOAM531obBa5/Zl88H6jVc21b/vmULfy/S1nbeFidVKI0YpASLPJaPsF eMaJqJsTXMBuqnZxvNlZiYt/ca59w7fLjRXNjiM= X-Google-Smtp-Source: ABdhPJyf5tdTMGtMnEDGjUnv92uush/stwQk/V275HYnmvUKGcgf2TZgrFQiFBfxTe7zrkorAtbhQZUX6T8CMT38TuE= X-Received: by 2002:ac5:c80a:: with SMTP id y10mr3590416vkl.3.1619779421481; Fri, 30 Apr 2021 03:43:41 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=209.85.221.173; envelope-from=mdjurfeldt@gmail.com; helo=mail-vk1-f173.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17484 Archived-At: The superclass question is a matter of taste. First note that in CLOS-like objects systems, such as GOOPS, methods are not components of classes but it is rather the set of operations =3D generics/methods around a type which define its behavior. Roughly speaking, the only things directly tied to the class are the slots. In this regard is opaque---there are no accessible slots. Therefore, if using it as a superclass, it won't add any slots to your instances apart and above what you explicitly add in your class definition. So, you should think of the role of as a superclass more in terms of natural grouping, and its role in selecting methods when you operate on the object using generics, than anything else. The *only* functional effect of using as a superclass in this case is that methods taking an argument will also accept instances of as an argument. (This does not apply to *functions* now taking array as an argument.) I would say that you could choose between having no explicit superclass and having as superclass. In your case there would not be any big functional difference. If you, in your last answer, by "template" refer to my answer, then you are of course free to replace all stuff with the corresponding stuff. In my example, I chose to use as superclass because I regarded to be a specialization. It is true that logically could be regarded as a specialization of , but you can't do anything about that. Best regards, Mikael On Fri, Apr 30, 2021 at 11:48 AM Damien Mattei wrote: > thank for your answer but my question was just about use of superclass...= . > SRFI implementation is too complex for what i want to do now, > template is 1 dimension gvector, that's neolithic for me :-) and do not > explain use of superclass... > Damien > > On Fri, Apr 30, 2021 at 9:57 AM Linus Bj=C3=B6rnstam < > linus.internet@fastmail.se> > wrote: > > > This does not answer your question, but: > > > > There was just a SRFI released for growable vectors. I don't know about > > any interest to have it included in guile, but the reference implentati= on > > is probably trivially portable: > > https://srfi.schemers.org/srfi-214/srfi-214.html > > > > > > > > -- > > Linus Bj=C3=B6rnstam > > > > On Fri, 30 Apr 2021, at 01:10, Damien Mattei wrote: > > > hi, > > > i want to create a growable vector class in Guile, > > > such as std::vector or python list, > > > first i do not know if it exist already? seems not > > > > > > i want to use GOOPS but i do not understand how the superclass could = be > > > accessed,used, instanciate... > > > for example in the doc there is: > > > (define-class () r i #:name "Complex") > > > > > > seems superclass is of no use > > > > > > for my growable vector i would like to use array as superclass? > > > but perhaps should it be just a slot as array are a subset of growabl= e > > > array ,so a subclass > > > > > > anyway if i write something ike that: > > > (define-class () ..... > > > how can i use the object? > > > > > > i think perhaps i should not define a superclass or as super > > > class.... > > > any advice welcome... > > > > > > Damien > > > > > >