Email list hosting service & mailing list manager

define-library-alias Lassi Kortela (26 May 2020 13:34 UTC)
Re: define-library-alias Shiro Kawai (27 May 2020 00:08 UTC)
Re: define-library-alias Alex Shinn (27 May 2020 00:35 UTC)
Re: define-library-alias Shiro Kawai (27 May 2020 01:30 UTC)
Re: define-library-alias Jim Rees (23 Sep 2020 02:07 UTC)
Re: define-library-alias Jim Rees (23 Sep 2020 02:08 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (23 Sep 2020 06:02 UTC)
Re: define-library-alias Jim Rees (23 Sep 2020 12:52 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (23 Sep 2020 12:58 UTC)
Re: define-library-alias John Cowan (23 Sep 2020 21:45 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (24 Sep 2020 05:53 UTC)
Re: define-library-alias John Cowan (25 Sep 2020 21:27 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (26 Sep 2020 07:44 UTC)
Re: define-library-alias Jim Rees (26 Sep 2020 21:11 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (26 Sep 2020 21:23 UTC)
Re: define-library-alias Jim Rees (27 Sep 2020 01:44 UTC)
Re: define-library-alias John Cowan (27 Sep 2020 17:49 UTC)
Re: define-library-alias Arthur A. Gleckler (27 Sep 2020 18:16 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (29 Sep 2020 16:13 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (30 Sep 2020 07:08 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (29 Sep 2020 16:00 UTC)
Re: define-library-alias Jim Rees (26 Sep 2020 01:05 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (26 Sep 2020 07:49 UTC)
Re: define-library-alias Alex Shinn (27 May 2020 03:26 UTC)
Re: define-library-alias Shiro Kawai (27 May 2020 04:09 UTC)
Re: define-library-alias Lassi Kortela (27 May 2020 07:27 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (27 May 2020 07:53 UTC)
Re: define-library-alias Lassi Kortela (27 May 2020 07:57 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (27 May 2020 08:05 UTC)
SCHEME_PATH and library lookup metadata files Lassi Kortela (27 May 2020 08:15 UTC)
Re: SCHEME_PATH and library lookup metadata files Marc Nieper-Wißkirchen (27 May 2020 08:24 UTC)
Re: SCHEME_PATH and library lookup metadata files Lassi Kortela (27 May 2020 09:04 UTC)
Reader flags to indicate different kinds of files Lassi Kortela (27 May 2020 09:14 UTC)
Re: Reader flags to indicate different kinds of files Marc Nieper-Wißkirchen (27 May 2020 09:21 UTC)
Re: Reader flags to indicate different kinds of files Lassi Kortela (27 May 2020 09:51 UTC)
Re: Reader flags to indicate different kinds of files Marc Nieper-Wißkirchen (27 May 2020 10:21 UTC)
Re: Reader flags to indicate different kinds of files Per Bothner (27 May 2020 14:42 UTC)
Re: Reader flags to indicate different kinds of files John Cowan (27 May 2020 17:46 UTC)
Re: Reader flags to indicate different kinds of files Marc Nieper-Wißkirchen (27 May 2020 20:16 UTC)
Re: Reader flags to indicate different kinds of files Lassi Kortela (29 May 2020 16:03 UTC)
Re: Reader flags to indicate different kinds of files Marc Nieper-Wißkirchen (29 May 2020 17:03 UTC)
Re: Reader flags to indicate different kinds of files Lassi Kortela (29 May 2020 17:09 UTC)
Re: Reader flags to indicate different kinds of files Marc Nieper-Wißkirchen (29 May 2020 17:52 UTC)
Data vs metadata distinction Lassi Kortela (29 May 2020 17:59 UTC)
Re: Data vs metadata distinction Marc Nieper-Wißkirchen (02 Jun 2020 09:43 UTC)
Re: Reader flags to indicate different kinds of files John Cowan (29 May 2020 17:15 UTC)
Re: Reader flags to indicate different kinds of files Lassi Kortela (29 May 2020 17:26 UTC)
Re: Reader flags to indicate different kinds of files Lassi Kortela (29 May 2020 17:41 UTC)
Re: Reader flags to indicate different kinds of files John Cowan (29 May 2020 18:04 UTC)
Re: SCHEME_PATH and library lookup metadata files Marc Nieper-Wißkirchen (27 May 2020 09:26 UTC)
Scheme filename extensions Lassi Kortela (27 May 2020 09:40 UTC)
Re: Scheme filename extensions Marc Nieper-Wißkirchen (27 May 2020 09:49 UTC)
Re: Scheme filename extensions Marc Nieper-Wißkirchen (27 May 2020 09:51 UTC)
Re: Scheme filename extensions Lassi Kortela (27 May 2020 10:21 UTC)
Re: Scheme filename extensions Alex Shinn (27 May 2020 09:55 UTC)
Re: Scheme filename extensions Lassi Kortela (27 May 2020 10:30 UTC)
Library lookup metadata file Lassi Kortela (27 May 2020 10:32 UTC)
Re: Scheme filename extensions John Cowan (28 May 2020 17:30 UTC)
Re: define-library-alias Alex Shinn (04 Jun 2020 14:57 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (04 Jun 2020 15:31 UTC)
Re: define-library-alias Marc Feeley (04 Jun 2020 15:37 UTC)
Re: define-library-alias Lassi Kortela (04 Jun 2020 15:39 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (21 Sep 2020 06:13 UTC)
Re: define-library-alias Lassi Kortela (22 Sep 2020 16:05 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (22 Sep 2020 16:13 UTC)
Re: define-library-alias Lassi Kortela (22 Sep 2020 16:41 UTC)
Re: define-library-alias Marc Nieper-Wißkirchen (22 Sep 2020 17:13 UTC)

Re: define-library-alias Marc Nieper-Wißkirchen 26 Sep 2020 07:44 UTC

Am Fr., 25. Sept. 2020 um 23:27 Uhr schrieb John Cowan <xxxxxx@ccil.org>:

>> What I have
>> been discussing with Jim lately is the following: If a library exports
>> an identifier `foo', one can access all (not renamed) identifiers that
>> are defined at the top-level of the library, namely through
>> (datum->syntax #'foo top-level-identifier-name) or a similar
>> construction for the given macro system that allows unhygienic
>> bindings. Therefore, not only the set exported identifiers but also
>> the top-level environment of a library is an observable quantity.
>
>
> I tried this in Guile with an R6RS library that defines trivial procedures foo and bar and exports foo.  Evaluating (datum->syntax #'foo 'bar) gives me #<syntax bar>, but I do not see how to invoke the procedure bound to bar.  Furthermore, if I try it with baz instead of bar, I get #<syntax baz>, pretty much indistinguishable.  So it is not leaking even the names of top-level bindings, never mind their values.  The same is true in Chez.

There are two issues here.

The first is that you don't want the bar and baz syntax objects at
run-time but at expand-time, so you have to change the phase level
using define-syntax, i.e. you have to produce the syntax objects in a
macro transformer, which is then fed into the expander.

The bigger issue is that I wrote my earlier paragraph without thinking
enough. The "forging" (datum->syntax #'foo top-level-identifier-name)
only works when foo has the correct syntactic environment. However,
the imported identifier foo has the syntactic environment of the
top-level environment of the importing library/program. So you have to
move the syntax definition for forging into the library with the
top-level-identifier:

$ cat test.sld
(define-library (test)
  (export get public)
  (import (scheme base)
          (srfi 211 syntax-case))
  (begin
    (define (public) 'public)
    (define (private) 'private)
    (define-syntax get
      (lambda (stx)
        (syntax-case stx ()
          ((_ id)
           (datum->syntax #'public (syntax->datum #'id))))))))
$ unsyntax-scheme -I .
Unsyntax 0.0.2.5-601a-dirty
Copyright (C) 2020 Marc Nieper-Wißkirchen

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

#,> (import (test))
#,> (public)
public
#,> (private)
error: non procedure application: (#<undef>)
#,> (get private)
#<procedure private.17462>
#,> ((get private))
private

This doesn't change my original point, though: As it is generally
undecidable whether a top-level library exports a syntax like `get`, a
library defines not only its exports but also its top-level bindings.

#,> (define x 1)
#,> (import (srfi 211 syntax-case))
#,> (free-identifier=? #'x (datum->syntax #'public 'x))

This last example shows that the syntactic environment of the
*imported* identifier public is the one of the importing
library/module.

Marc