From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x92d.google.com (mail-ua1-x92d.google.com [IPv6:2607:f8b0:4864:20::92d]) by sourceware.org (Postfix) with ESMTPS id 75EBE3858D33 for ; Sun, 20 Nov 2022 23:29:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 75EBE3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ua1-x92d.google.com with SMTP id s16so930317uaq.12 for ; Sun, 20 Nov 2022 15:29:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=g6JEM5TO106tfaBvZWThGdM/Y0SpWBjgcVdpfdkdEOU=; b=OstkZICjkZq5AglCo2qvjIx9rmsFL1FewghXxxwKYnnyhc4RqJpMIqfX3nRdh+Kqll 0/kwAowQiYd9bHHiflGulFWZzAkpG/cyuh1sEMZBHXdiwMx+uetyvYt8b5bFLikyKynF R4qJyUhy1xdw06OjHGvp60yadGxNXweNMn7vgJwE7NC9Hr1JS7MHjjsltYqLfkn1EruW 778qXZHxHsZ75wOExIVM3C3V05ZC/ZHuvmuE9UrDwd9r0NpIhwymJzxSuzxZEdJRkP60 WRK3D1bpricah5VrtXCoXeDSYBV01YO/Bm4CtNM6e/Bfm7oIfXYDfc6ptivKLOmCGWPg iqWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=g6JEM5TO106tfaBvZWThGdM/Y0SpWBjgcVdpfdkdEOU=; b=nMGal28OxjiksPb3UEP60OVtqje4FXKjtxltNV+QCFIho8qLhT/UqTuzfH+Qt2fIo4 3RBWYrpuGBbIDX/dHbswkFNsH4G6wHWOKbON6R7l/xOLTtPfhDp4/0FSrzLb6Y18aSLm oYG8Q+4fbK+Mg1LyE5vNUkr5e6HzR9rue7ndYvC3x/AvKArew+1N4QAJvQBxUUAw/VVj B6np12g2vsq6HtpaIbgTqF0swoexrgOOhrsmU6Xv2cbgoixB2InJISOnI2CwQ76oN34b vN9l6dTHbo0xpETguY4eSvAxYxel3KYkA9EworKcoGTqL9Un5lsIjK2LFqyhDWt6n0IQ WG+w== X-Gm-Message-State: ANoB5plT1bDipNdtLXWkKM4s4QUbHTe5TbZvhlngridK91t9kY1M52Nl Eg1TQnH/6u1HfqHBy3r4UMIwsfVEN7zDwUvANyXIXsd3lws= X-Google-Smtp-Source: AA0mqf4fNE0o+p7oZJWXEYFFlISU7ihoKXlsGtFBRAQdjw7iXEUOorm/1Potfe4CeCkgLbgEnVpxv4wVtd8THo2wlCM= X-Received: by 2002:ab0:7794:0:b0:418:c17a:38b0 with SMTP id x20-20020ab07794000000b00418c17a38b0mr3767860uar.102.1668986956323; Sun, 20 Nov 2022 15:29:16 -0800 (PST) MIME-Version: 1.0 References: <6d811ecb-2c95-a973-9e78-279f5e608883@bothner.com> In-Reply-To: <6d811ecb-2c95-a973-9e78-279f5e608883@bothner.com> From: Panicz Maciej Godek Date: Mon, 21 Nov 2022 00:29:05 +0100 Message-ID: Subject: Re: "define-constant is only allowed in a " To: Per Bothner Cc: kawa@sourceware.org Content-Type: multipart/alternative; boundary="000000000000aaa19905edef4e32" X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000aaa19905edef4e32 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable niedz., 20 lis 2022 o 23:41 Per Bothner napisa=C5=82(a): > > > On 11/19/22 06:37, Panicz Maciej Godek via Kawa wrote: > > When I try to use this code from yet another module -- more specificall= y, > > this one: > > > > > https://github.com/panicz/grasp-android/blob/master/stages/retreat/GRASP/= src/panel.scm#L130 > > > > as > > > > (define-mapping (on-key-press code) never) > > > > I get the error message > > > > define-constant is only allowed in a > > > > but when I use the expanded version > > > > (define on-key-press (mapping (code) never)) > > > > everything works. > > > > I wonder what could be the reason of Kawa's behavior. > > Kawa is presumably complaining that the define-early-constant is > in a non- context. > > This is allowed: > (begin (define-early-constant ...) ...) > > This is not: > (list (define-early-constant ...) ...) > > One of the problems with Scheme S-expression-based syntax is that > it is sometimes tricky to tell what parenthesis does what. > For example, it is easy to end up with this after some macro-expansion: > > ((define-early-constant ...)) > > I understand this message the way you explained it -- it just doesn't make sense in my context. There seems to be an issue with module dependency resolution. The problematic expansion was in the (panel) module. It contains a dependency on the (mapping) module. The main module (either grasp-terminal.scm or grasp-desktop.scm) included (import (panel)), and the compilation failed with the above message. But when I add (import (mapping)) to the main module -- before the (import (panel)) clause -- the compilation succeeds. (However, if I add it after (import (panel)) -- it still breaks). I realized that I ran into that problem early on during my work, but instead of reporting it, I just started including module dependencies transitively in the "right order". This is a workaround, but I think that there might be some issue between reflection, macro expansion and module dependency loading. I'll let you know if I manage to find a minimal set of modules which break in this way. --000000000000aaa19905edef4e32--