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: Setting variables in declarative modules Date: Fri, 1 Nov 2024 16:28:26 +0100 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="19458"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?UTF-8?B?VG9tbWkgSMO2eW7DpGzDpG5tYWE=?= , Guile User , Mikael Djurfeldt To: "Thompson, David" Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Nov 01 16:29:13 2024 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 1t6taL-0004uL-AI for guile-user@m.gmane-mx.org; Fri, 01 Nov 2024 16:29:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6tZs-0000f1-3c; Fri, 01 Nov 2024 11:28:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6tZp-0000dw-ES for guile-user@gnu.org; Fri, 01 Nov 2024 11:28:42 -0400 Original-Received: from mail-ua1-f52.google.com ([209.85.222.52]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6tZn-0003E5-Tu for guile-user@gnu.org; Fri, 01 Nov 2024 11:28:41 -0400 Original-Received: by mail-ua1-f52.google.com with SMTP id a1e0cc1a2514c-84fcfe29e09so540572241.2 for ; Fri, 01 Nov 2024 08:28:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730474919; x=1731079719; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/oSJEJYR4KFg2Xt0pVUx6li+/14CXH29mea1aaj1bbU=; b=YHS/XTZLYg5BjkhrdG4kEcTNI7mM4JRSkoYrFVvBPTFL+u/gR/jujgl9p6Gec4Ro4B jKBQxx+q7M38s63KqoF5knuTgTtolrxZnehpyX0gU1+OqAhw/8GeJ7GixeZu0RthHRWf nllCbQ9DTuYug9kQqVU0Fj1+S0KRyGvriTjEVsRDMTUJEUijrAipPTojrLI+jR58TEz+ lEEMCa41G7o27/ZT142bUcvsaBrN7TVW3ij5FgwlOUrvjL1UKqw7op8gmN/DE4WXhyCV KZxqnjxMxcDDTV29eZVAzb0EEC8pesK6+AAyyw46fDrb6RmDmo33gxrXrqC7Ychu41yh KL4A== X-Forwarded-Encrypted: i=1; AJvYcCXf4v9DJM0FtMFZ9FybRSM1B+/nGGLhaVrJOg2TqAdhPwFVERtSeev5hre2tGuDOIBRpxM0WzYU58wf@gnu.org X-Gm-Message-State: AOJu0YyNFcsFWDf0Fnc2RxS52aqFYfR+VRO25N9zYgCa2J0i4aT++43h VOt5/JrhEVUat3f6PqdRIy1OOBmxPSeZ9t5T3m0vbA9fOcF3/ifekJP53N4p+O5MvJJ2ay4qKwZ KtaxVd10JoETSacIN18vXl03vXsQ= X-Google-Smtp-Source: AGHT+IE6bqIXni7vXB0uIAhPydW2N7HuH4nUN/2P+aWXG8PSx0T6jnevpafPgkD7HGM2AASIgVjldxaKFe/Wv/S6oFY= X-Received: by 2002:a05:6122:3094:b0:50d:b561:33bd with SMTP id 71dfb90a1353d-5106b1bf92cmr8355429e0c.12.1730474917272; Fri, 01 Nov 2024 08:28:37 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=209.85.222.52; envelope-from=mdjurfeldt@gmail.com; helo=mail-ua1-f52.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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.29 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 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-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19869 Archived-At: One additional comment regarding this: The first definition in your example, Tommi, isn't required. The order of the definitions don't matter as long as a variable reference isn't required to compute the value being defined. In your case, the variable references aren't resolved until the procedures are executed. Meanwhile the bindings my-proc and fw-proc get their values just fine without a need to resolve the reference to fw-proc inside my-proc. On Fri, Nov 1, 2024 at 2:21=E2=80=AFPM Thompson, David wrote: > Hi Tommi, > > On Thu, Oct 31, 2024 at 10:30=E2=80=AFPM Tommi H=C3=B6yn=C3=A4l=C3=A4nmaa > wrote: > > > > Suppose that I have the following code in a Guile module: > > --- > > (define fw-proc #f) > > > > (define (my-proc x) > > (display (fw-proc x))) > > > > (define (fw-proc x) > > (cons x x)) > > --- > > > > Can I declare the module as declarative? > > Yes, this is fine. If you put this in a module file and compile it, > Guile does not issue any warnings. `define` is not `set!`. (Modules > are declarative by default, btw.) > > - Dave > >