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: Sun, 2 May 2021 12:21:27 +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="708"; 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 Sun May 02 12:28:03 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 1ld9KU-000Acu-Gm for guile-user@m.gmane-mx.org; Sun, 02 May 2021 12:28:02 +0200 Original-Received: from localhost ([::1]:59856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ld9KT-0004a2-Im for guile-user@m.gmane-mx.org; Sun, 02 May 2021 06:28:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ld9ER-0000dB-EF for guile-user@gnu.org; Sun, 02 May 2021 06:21:53 -0400 Original-Received: from mail-vs1-f43.google.com ([209.85.217.43]:46637) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ld9EM-00060h-8F for guile-user@gnu.org; Sun, 02 May 2021 06:21:44 -0400 Original-Received: by mail-vs1-f43.google.com with SMTP id b4so1469691vst.13 for ; Sun, 02 May 2021 03:21:38 -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=kDjS9E9oNfE8PvmiTLSNk2oUO4NzbEq0spVzJKpYvac=; b=FGXzkC4Gm51xJYwf8m7oHa/c7oZS/ADqRpFsj+6BaZb/N29T6AzRINXtHiDMmQXCHR lWx6rmVPNPl3Etd7+fJmYwYJQ9a6HgzcnvpL3se5rGqyVzSH0C0CdhfQrh2Gecoj9uwM ZJtOH4+059u5g/6DgLoJImqckUpT2MxhM5NHSSuS8td7Fl2FRQCerm2XRThULYd98G9C XW02mcATGH7Ji3kOE5L/fyECNe0WuZjUyLbnvqQpPOqfUqpz2RVkdKDmJGIiX889Ct3S n5FX1NE588RXRK1Et0SiBI/MXkFKL+k36Ed08FoWueWHYLK5s3F/3RdfwbnDTgWovnnt F8vA== X-Gm-Message-State: AOAM532cXN2q++VcToYOpgNko1bU3RuZglnITxgdm/QBM6nj9DFPjFYI gEwjAEjKYFNKIkBzXfTx/MZqk26NseXfDBwkAcw= X-Google-Smtp-Source: ABdhPJwJd6Od85J1Q4JSovY5Z1e4Ew7Lz4cAxks/+jPjChI+/o6L8ic6quI9z0gcrg/P63VdlIEhdQNDxHY+N68xJGE= X-Received: by 2002:a05:6102:72c:: with SMTP id u12mr12286593vsg.3.1619950897630; Sun, 02 May 2021 03:21:37 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=209.85.217.43; envelope-from=mdjurfeldt@gmail.com; helo=mail-vs1-f43.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:17496 Archived-At: My template file creates the module (oop gvector). (Probably a bad name for this module, btw.) If you load it using load, you will still be in the (guile-user) module, so you won't see its bindings. To see them, you can do: (use-modules (oop gvector)) after having loaded the module using load. Alternatively, you could put oop/gvector.scm somewhere on your %load-path, in which case you don't need to explicitly load the module before calling use-modules. If you remove the module part, you will need to get at the orig:-bindings in some other way. Finally, note that I by accident used the wrong accessor in assert-size! It should be vector-length. Den s=C3=B6n 2 maj 2021 02:08Damien Mattei skrev: > seems your template isn't working: > > scheme@(guile-user)> (load "gvector.scm") > > ;;; note: source file > /Volumes/Mojave/Users/mattei/Dropbox/git/library-FunctProg/gvector.scm > > ;;; newer than compiled > > /Users/mattei/.cache/guile/ccache/2.2-LE-8-3.A/Volumes/Mojave/Users/matte= i/Dropbox/git/library-FunctProg/gvector.scm.go > > ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=3D0 > > ;;; or pass the --no-auto-compile argument to disable. > > ;;; compiling > /Volumes/Mojave/Users/mattei/Dropbox/git/library-FunctProg/gvector.scm > > ;;; compiled > > /Users/mattei/.cache/guile/ccache/2.2-LE-8-3.A/Volumes/Mojave/Users/matte= i/Dropbox/git/library-FunctProg/gvector.scm.go > > scheme@(guile-user)> (define c2 (make )) > > ;;; :2:11: warning: possibly unbound variable `make' > > ;;; :2:11: warning: possibly unbound variable `' > > :2:0: In procedure module-lookup: Unbound variable: make > > > Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. > > scheme@(guile-user) [1]> ,bt > > In current input: > > 2:0 0 (_) > > but things go well if i remove module part and add: > > (use-modules (oop goops) > (oop goops describe)) > > scheme@(guile-user)> (load "gvector.scm") > > ;;; note: source file > /Volumes/Mojave/Users/mattei/Dropbox/git/library-FunctProg/gvector.scm > > ;;; newer than compiled > > /Users/mattei/.cache/guile/ccache/2.2-LE-8-3.A/Volumes/Mojave/Users/matte= i/Dropbox/git/library-FunctProg/gvector.scm.go > > ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=3D0 > > ;;; or pass the --no-auto-compile argument to disable. > > ;;; compiling > /Volumes/Mojave/Users/mattei/Dropbox/git/library-FunctProg/gvector.scm > > ;;; > > /Volumes/Mojave/Users/mattei/Dropbox/git/library-FunctProg/gvector.scm:21= :2: > warning: possibly unbound variable `orig:vector-length' > > ;;; > > /Volumes/Mojave/Users/mattei/Dropbox/git/library-FunctProg/gvector.scm:26= :2: > warning: possibly unbound variable `orig:vector-set!' > > ;;; > > /Volumes/Mojave/Users/mattei/Dropbox/git/library-FunctProg/gvector.scm:31= :2: > warning: possibly unbound variable `orig:vector-ref' > > ;;; compiled > > /Users/mattei/.cache/guile/ccache/2.2-LE-8-3.A/Volumes/Mojave/Users/matte= i/Dropbox/git/library-FunctProg/gvector.scm.go > > scheme@(guile-user)> (define c2 (make )) > > scheme@(guile-user)> c2 > > $1 =3D #< 109e82500> > > scheme@(guile-user)> (describe c2) > > #< 109e82500> is an instance of class > > Slots are: > > v =3D #(# # # # > # # # #) > > length =3D 0 > > probably a module issue.... but i never use them with this Scheme > otherwise things go well (in other file ....) > Damien > > On Fri, Apr 30, 2021 at 9:55 AM Mikael Djurfeldt > wrote: > > > Hi! > > > > I attach a template which you could build on. Please post your class wh= en > > you're done. :) > > > > Best regards, > > Mikael > > > > On Fri, Apr 30, 2021 at 1:11 AM 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 b= e > >> 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 growable > >> 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 > >> > > >