Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Warp 7 -- It's a law we can live with.


devel / comp.lang.scheme / (Guile) using a macro to declare exports with Guile modules

SubjectAuthor
* (Guile) using a macro to declare exports with Guile modulesalicetril...@gmail.com
`- Re: (Guile) using a macro to declare exports with Guile modulesalicetril...@gmail.com

1
(Guile) using a macro to declare exports with Guile modules

<7a2ca61a-c2d3-4381-9f38-ab1b13593669n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=255&group=comp.lang.scheme#255

  copy link   Newsgroups: comp.lang.scheme
X-Received: by 2002:a05:6214:aa6:b0:66d:3384:1b with SMTP id ew6-20020a0562140aa600b0066d3384001bmr6286qvb.5.1700250833319;
Fri, 17 Nov 2023 11:53:53 -0800 (PST)
X-Received: by 2002:a05:6a00:4c81:b0:68f:cd81:8799 with SMTP id
eb1-20020a056a004c8100b0068fcd818799mr110581pfb.3.1700250832949; Fri, 17 Nov
2023 11:53:52 -0800 (PST)
Path: i2pn2.org!rocksolid2!news.neodome.net!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.scheme
Date: Fri, 17 Nov 2023 11:53:52 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:e190:b9b0:0:0:0:48;
posting-account=v_SVOwoAAADqhdg0geGPqbN_ubI98Rqh
NNTP-Posting-Host: 2600:1700:e190:b9b0:0:0:0:48
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7a2ca61a-c2d3-4381-9f38-ab1b13593669n@googlegroups.com>
Subject: (Guile) using a macro to declare exports with Guile modules
From: alicetrillianosako@gmail.com (alicetril...@gmail.com)
Injection-Date: Fri, 17 Nov 2023 19:53:53 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2902
 by: alicetril...@gmail.c - Fri, 17 Nov 2023 19:53 UTC

I am writing a toy Scheme compiler in Guile, and part of the design is to dynamically bind system-specific procedures to a generic ones so as to improve the system independence. The intention is to have a pair of macros which take a system enum and a list of bindings, and use them to a) create the export list for the system-specific modules, b) generate a corresponding list of system-independent names which can then c) be bound to the system-dependent imports at runtime.

The relevant code for the first macro is:

(define (append-specific patch item)
(string->symbol
(string-append
(symbol->string patch)
(string-append "-"
(symbol->string item)))))

(define-syntax map-specific
(syntax-rules ()
((_ patch reconciliations)
(let* ((expanded-patch (make-list (length reconciliations) patch))
(patched (map append-specific expanded-patch reconciliations)))
(eval `(export ,@patched) (interaction-environment))))))

And it is invoked at the end of the system-specific module for AMD64 code thusly:

(map-specific (supported-isa amd64) isa-reconciliations)

Where isa-reconciliations is a list of procedure names.

Unfortunately, while the macros I wrote compile correctly, the do not seem to actually generate the exports correctly; when I (use-modules) in the REPL to get the imports of the system-dependent procedures, they do not actually get imported.

The full code is at https://github.com/Schol-R-LEA/Petty-Scheme/blob/refactoring-file-interface/petty/reconciliations.scm and https://github.com/Schol-R-LEA/Petty-Scheme/blob/refactoring-file-interface/petty/amd64.scm

I am assuming that the macro in question is not correct. Can anyone offer any advice on this matter?

Re: (Guile) using a macro to declare exports with Guile modules

<5e6fda22-a3fa-4501-a635-d68e60526912n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=257&group=comp.lang.scheme#257

  copy link   Newsgroups: comp.lang.scheme
X-Received: by 2002:a05:622a:5a97:b0:41e:311a:77ac with SMTP id fz23-20020a05622a5a9700b0041e311a77acmr278360qtb.11.1700534059215;
Mon, 20 Nov 2023 18:34:19 -0800 (PST)
X-Received: by 2002:a63:4917:0:b0:5be:3925:b5b4 with SMTP id
w23-20020a634917000000b005be3925b5b4mr1896105pga.9.1700534058884; Mon, 20 Nov
2023 18:34:18 -0800 (PST)
Path: i2pn2.org!i2pn.org!news.1d4.us!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!fdn.fr!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.scheme
Date: Mon, 20 Nov 2023 18:34:18 -0800 (PST)
In-Reply-To: <7a2ca61a-c2d3-4381-9f38-ab1b13593669n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:e190:b9b0:0:0:0:48;
posting-account=v_SVOwoAAADqhdg0geGPqbN_ubI98Rqh
NNTP-Posting-Host: 2600:1700:e190:b9b0:0:0:0:48
References: <7a2ca61a-c2d3-4381-9f38-ab1b13593669n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5e6fda22-a3fa-4501-a635-d68e60526912n@googlegroups.com>
Subject: Re: (Guile) using a macro to declare exports with Guile modules
From: alicetrillianosako@gmail.com (alicetril...@gmail.com)
Injection-Date: Tue, 21 Nov 2023 02:34:19 +0000
Content-Type: text/plain; charset="UTF-8"
 by: alicetril...@gmail.c - Tue, 21 Nov 2023 02:34 UTC

I've concluded that the design I was planning to use wasn't viable.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor