Therefore, unless I get strong feedback to the contrary in the next week or so, I will create a ballot form for the Kronos Docket, which contains mostly macro-related proposals: 9 SRFIs; three unmodified R6RS sections (syntax-case, identifier-syntax as an operand, identifier-syntax for `set!`); and explicit renaming, which currently links to the MIT explanation as most comprehensive. (The explanation in SRFI 211 is more precise but also depends on understanding syntax-case concepts.) PLEASE NOTE that syntax-case and explicit renaming will be voted on separately, not as alternatives to one another. They are equivalent in expressive power, but neither can be implemented on top of the other.
The examples of 'loop' and 'while' on MIT's page do not work in all circumstances (see SRFI 211).If you want correct unhygienic macros with ER based on existing implementations, you need to borrow forms from syntax-case (which are usually not part of existing ER systems). SRFI 211 strives to correct ER but is yet only implemented fully in Unsyntax. (And once you have given ER the power, you can add more or less for free the full syntax-case system.)
I think it is better if people are fully and correctly informed before the voting process starts, especially in the area of macro systems where, unfortunately, a lot of FUD was spread.
On Wed, Aug 4, 2021 at 5:29 PM Marc Nieper-Wißkirchen <marc....@gmail.com> wrote:The examples of 'loop' and 'while' on MIT's page do not work in all circumstances (see SRFI 211).If you want correct unhygienic macros with ER based on existing implementations, you need to borrow forms from syntax-case (which are usually not part of existing ER systems). SRFI 211 strives to correct ER but is yet only implemented fully in Unsyntax. (And once you have given ER the power, you can add more or less for free the full syntax-case system.)Can you take a look at <https://www.mail-archive.com/larcen...@lists.ccs.neu.edu/msg00097.html> and see if this is equivalent to what you are describing? It depends on an underlying syntax-case implementation in which the input to a transformer is unwrapped, such as the one in SRFI 72. Both are by Andre van Tonder.
I think it is better if people are fully and correctly informed before the voting process starts, especially in the area of macro systems where, unfortunately, a lot of FUD was spread.So do I, absolutely.
I have some very non-trivial syntax-case macros in my hobby-projects
that I wrote when I had more free time. I rely on them and need them,
but I don‘t know whether I’d ever be able to port them to a new
macro-system. So if compatibility with R6RS is not a goal, these
projects — some of my most exciting projects — could forever be barred
from porting to R7RS.
So before voting on whether to include ER or not, we should settle which version and see that this version gets also the corner cases right.
Would you mind postponing discussing the ballot and the actually ballotting by a few weeks. At least in many places in the northern hemisphere, there are currently holidays so a part of our community wouldn't be able to discuss these important matters.
As for what's on the ballot, independently of what I think would be the best choice, just asking for ER and syntax-case independently is not enough, I think. People may have a strong opinion to include only one system, no matter what. Or an opinion of, say, ER at all events and maybe syntax-case, but not vice versa.
A yet missing option is on the R4RS low-level macro system (see the appendix of R4RS and SRFI 211). It combines the soundness of the syntax-case system with the no-bells-and-whistles approach of ER (meaning no pattern matcher in the form of syntax-case).
- Please postpone SRFI 147 to a later ballot. It is for systems not necessarily offering procedural macros and is not compatible with syntax-case because syntax-case says that the <transformer> in a syntax definition is an ordinary expression. (When available, the latter is much more powerful and definitely better.)
- Before voting for the identifier-syntax form in R6RS (which is just library syntax in terms of syntax-case), it is important to vote for what is a macro use as per section 9.2 of the R6RS. In R7RS, it is only the first form. In R6RS, there are four forms.
- What is meant by "SRFI 17 or identifier-syntax"? How are they related? (See also my latest private email on this topic.)
But I feel that a meta-question should be answered first. Does R7RS-large strive for compatibility with R6RS and existing R6RS implementations or is this considered irrelevant?
R7RS-large would be the language to replace R6RS.
On Thu, Aug 5, 2021 at 2:43 AM Marc Nieper-Wißkirchen <marc....@gmail.com> wrote:So before voting on whether to include ER or not, we should settle which version and see that this version gets also the corner cases right.R7RS votes are not plebiscites: there may be more than one candidate (other than the usual No Vote, None, and Other). I have no trouble adding more than one version of ER to the ballot.
Would you mind postponing discussing the ballot and the actually ballotting by a few weeks. At least in many places in the northern hemisphere, there are currently holidays so a part of our community wouldn't be able to discuss these important matters.After running two ballots, I have observed that trying to take this into account cancels out. Some people don't read non-essential email on vacation, others read that kind of email *only* on vacation because they are too busy otherwise.
As for what's on the ballot, independently of what I think would be the best choice, just asking for ER and syntax-case independently is not enough, I think. People may have a strong opinion to include only one system, no matter what. Or an opinion of, say, ER at all events and maybe syntax-case, but not vice versa.That's the purpose of the "Other" choice, which allows you to say what you want.
A yet missing option is on the R4RS low-level macro system (see the appendix of R4RS and SRFI 211). It combines the soundness of the syntax-case system with the no-bells-and-whistles approach of ER (meaning no pattern matcher in the form of syntax-case).I would put that on the ballot if it was widely implemented, but it is not. That is also why syntactic closures and implicit renaming are not on the ballot. Again, "Other" remains an option.
- Please postpone SRFI 147 to a later ballot. It is for systems not necessarily offering procedural macros and is not compatible with syntax-case because syntax-case says that the <transformer> in a syntax definition is an ordinary expression. (When available, the latter is much more powerful and definitely better.)Moved to Morpheus.
- Before voting for the identifier-syntax form in R6RS (which is just library syntax in terms of syntax-case), it is important to vote for what is a macro use as per section 9.2 of the R6RS. In R7RS, it is only the first form. In R6RS, there are four forms.Voting for identifier-syntax (excluding the `set!` case) implies that identifier-syntax macro names in operand position are macro uses.
- What is meant by "SRFI 17 or identifier-syntax"? How are they related? (See also my latest private email on this topic.)You were right to say that SRFI-17 ycan't be defined on top of the two-argument form of identifier-syntax calls. But they provide essentially the same function, generalized `set!`, and so can appear as alternative proposals. (I note that Chez, Guile, Larceny, and Sagittarius support both.)
But I feel that a meta-question should be answered first. Does R7RS-large strive for compatibility with R6RS and existing R6RS implementations or is this considered irrelevant?To quote the WG2 charter: "When deciding which features to include in the language, working group 2 should consider all features provided by R6RS Scheme, and all criticisms of those features. Insofar as practical, the language should be backwards compatible with an appropriate subset of the R6RS standard."
R7RS-large would be the language to replace R6RS.I can't find any reference to such a claim, certainly not in the official documents at scheme-reports.org. It's possible that such a statement was made informally. If R6.1RS goes anywhere, that would be the natural successor to R6RS.
R7RS-large would be the language to replace R6RS.I can't find any reference to such a claim, certainly not in the official documents at scheme-reports.org. It's possible that such a statement was made informally. If R6.1RS goes anywhere, that would be the natural successor to R6RS.It was you in the early years of R7RS who made such a statement, but obviously informally. As the size and scope of
--
You received this message because you are subscribed to the Google Groups "scheme-reports-wg2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scheme-reports-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scheme-reports-wg2/CAEYrNrS%2B5Pghu%3DX2_Hbn1iTsM2kvarpFc4WHyj2vJpnCDGKR5A%40mail.gmail.com.
On 06.08.2021 14.07, Linas Vepstas wrote:
> I work with a system that stores s-expressions in a database. Like all
> good databases, these can be added and removed at any time, and It has
> a pattern-matching system, so that users can search for what they
> want. Very loosely, very roughly, it is syntax-case-like, but, of
> course, at run-time, because the collection of s-expressions is
> constantly changing. Over the years, it's gotten quite fancy, being
> driven by user demands.
>
> The question is: would it be possible to build such a system in pure
> scheme, using one of the proposed macro systems to perform the
> term-rewriting? That is, given a collection of s-expressions, find the
> ones that match, per pattern-matcher, apply the transformations, and
> plop the result back into the database?
Scheme has traditionally had (match ...) for pattern-matching at
runtime. If you want to pattern-match using a macro, and the patterns
vary at runtime, you'd have to use (eval ...)
It would be nice if we could decouple macro hygiene from pattern
matching somehow, turning the two into orthogonal concepts, but it may
be too late to do that in standard Scheme.
> The syntax-case pattern matcher, which is the same as that of
> syntax-rules, can, of course, be used at runtime without the use of
> `eval`. It destructures syntax objects, which, likewise, also exist at
> runtime.
This is true if changing input is fed to fixed patterns. But if the
patterns themselves change at runtime, one needs `eval`, right? It's
like a fixed regexp vs a regexp that changes at runtime.
> Using `datum->syntax`, one can always turn an s-expression
> into a syntax object.
>
> If you want to apply `foo` to ordinary datums, you can write a wrapper
>
> (define foo*
> (lambda (x)
> (syntax->datum (foo (datum->syntax #'* x)))))
Doing this every time one wants to de-structure something is a bit of an
ordeal; it would be nice if there was an alternative that doesn't have
to go through syntax objects. It doesn't like much of a technical
problem, mainly a matter of agreement.
> Now one can ask why one should take a detour through syntax objects.
> Well, the advantage of syntax objects is that they can contain source
> location information. So for erroneous input that is presented as a
> syntax object, the syntax violation raised can point to the source code
> location of the erroneous input. (For example, it would have made a lot
> of sense for SRFI's regexp to take a syntax object instead of an
> s-expression.)
Good point.
> This is exactly what the syntax-case system achieves: It decouples the
> two parts of the syntax-rules: Pattern matching and templating.
I have a good impression of syntax-case, but now feel there's an extra
layer of genericity that would still be nice to extract for wider use.
The round trip through syntax objects would be nice to avoid in many cases.
Would it make sense to have a framework to define custom pattern
matchers, irrespective of whether syntax objects or unwrapped objects
are being matched against? The syntax-rules and syntax-case pattern
language could then be defined using this meta-language, as could the
various versions of `match`.
Now one can ask why one should take a detour through syntax objects. Well, the advantage of syntax objects is that they can contain source location information. So for erroneous input that is presented as a syntax object, the syntax violation raised can point to the source code location of the erroneous input. (For example, it would have made a lot of sense for SRFI's regexp to take a syntax object instead of an s-expression.)
Marc Nieper-Wißkirchen <marc....@gmail.com> writes:
> I'm wondering whether those who have only their vacation to participate
> should count as much as those who are active more or less the rest of the
> year.
I think that this question leads nowhere, because you could ask it the
other way round: Whether those who contribute only outside of vacation
should count as much as those who are only active during holiday-weeks.
Am Fr., 6. Aug. 2021 um 13:36 Uhr schrieb Marc Nieper-Wißkirchen <marc....@gmail.com>:Now one can ask why one should take a detour through syntax objects. Well, the advantage of syntax objects is that they can contain source location information.
Read: "SRFI 115's regexp".
Lassi Kortela <la...@lassi.io> writes:
>> The syntax-case pattern matcher, which is the same as that of
>> syntax-rules, can, of course, be used at runtime without the use of
>> `eval`. It destructures syntax objects, which, likewise, also exist
>> at runtime.
>
> This is true if changing input is fed to fixed patterns. But if the
> patterns themselves change at runtime, one needs `eval`, right? It's
> like a fixed regexp vs a regexp that changes at runtime.
You can still create new macros during runtime, because you can have
a syntax-case macro that uses "inner" syntax-case to create a new
syntax-case macro from its input.
I’m doing that in dryads-wake/enter to introduce new speakers.
(dryad (welcome)) ;; error
(Enter (dryad))
(dryad (welcome)) ;; writes "welcome"
On Fri, Aug 6, 2021 at 8:57 AM Marc Nieper-Wißkirchen <marc....@gmail.com> wrote:Am Fr., 6. Aug. 2021 um 13:36 Uhr schrieb Marc Nieper-Wißkirchen <marc....@gmail.com>:Now one can ask why one should take a detour through syntax objects. Well, the advantage of syntax objects is that they can contain source location information.They can, but it's not guaranteed by R6RS.
Good, but we need to know which versions and what their semantics are in detail.
I'm wondering whether those who have only their vacation to participate should count as much as those who are active more or less the rest of the year.
That's the purpose of the "Other" choice, which allows you to say what you want.That sounds good in theory, but does it work in practice? People voting are lazy.
Implementing the R4RS low-level system is less than trivial in a syntax-case system. It consists mostly of repackaging some already existing syntax keywords and procedures in a library. So you can effectively consider it widely implemented.
Adding it to an existing ER system is doable when the ER system has a mechanism to get unhygienic macros right.
Voting for identifier-syntax (excluding the `set!` case) implies that identifier-syntax macro names in operand position are macro uses.You probably mean that "macro names in operand position are macro uses". The notion an "identifier-syntax macro name" is not very interesting in itself.
And what about (foo . bar) when foo is a macro keyword? Would it be a macro use? It is in R6RS but not in R7RS.
- What is meant by "SRFI 17 or identifier-syntax"? How are they related? (See also my latest private email on this topic.)You were right to say that SRFI-17 ycan't be defined on top of the two-argument form of identifier-syntax calls. But they provide essentially the same function, generalized `set!`, and so can appear as alternative proposals. (I note that Chez, Guile, Larceny, and Sagittarius support both.)It seems to be that they are more orthogonal to each other than alternatives.
To quote the WG2 charter: "When deciding which features to include in the language, working group 2 should consider all features provided by R6RS Scheme, and all criticisms of those features. Insofar as practical, the language should be backwards compatible with an appropriate subset of the R6RS standard."Can you explain what this is supposed to mean in practice?
As the size and scope of R7RS-large will be much bigger than the size and scope of any R6.1RS,
--
You received this message because you are subscribed to the Google Groups "scheme-reports-wg2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scheme-reports-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scheme-reports-wg2/CAEYrNrTmnnu27A18Kq9gqnPTX50dGVGPKRwWSYgCiWEyN%3DRQ%3DA%40mail.gmail.com.
So far, so good.
The fun and games start with assorted "obvious" extensions:-- multiple variables.
-- searches over unordered sets. - this requires exploring all possible permutations of a set. This is particularly challenging when the sets are nested, and there are multiple variables.
-- Allowing boolean expressions in the pattern. In the above examples, the (and ...) is "the pattern". Some people want to nest "or" and "not" into there. This gets dicey when considering complex constructions like (or (not (is-present? ..)) (not (always? ...))) and this kind of stuff: (or (list 'a 'b $var1) (list $var2 'b 'c)) which leaves some variables ungrounded, but is perfectly valid in specific cases. (e.g. the robot arm picked up $var1 or $var2 is not on the table)
-- Allowing disconnected graphs. A quickie example:
(Skimming srfi-213, I find it odd that json is never mentioned: a key-value system is effectively the same thing as JSON.
This in itself is not hard, unless you plan to use the outputs for additional querying. Something stream or generator-ish seems needed. It's confusing.
--
You received this message because you are subscribed to the Google Groups "scheme-reports-wg2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scheme-reports-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scheme-reports-wg2/CAD2gp_ScVtms0C2UEyDG2U40tAbj5QRWWMFyPk_F-0t6hSUZ3A%40mail.gmail.com.
On Fri, Aug 6, 2021 at 1:54 AM Marc Nieper-Wißkirchen <marc....@gmail.com> wrote:Good, but we need to know which versions and what their semantics are in detail.I take it that you and others want SRFI 211, some will want Chicken (no syntactic closures), and some will want MIT/Chibi (with syntactic closures.) I don't know if the last two are the same. The more items, the more choice; the fewer items, the easier it is to get a resolution.
I'm wondering whether those who have only their vacation to participate should count as much as those who are active more or less the rest of the year.Quite apart from me not being able to weigh votes rather than counting them, I find that the people under the most work pressure, at least pre-pandemic, are the professors. And their weights, if we *were* to weigh votes, should certainly weigh more than, say, mine. Anyone who wishes to cast a fractional vote or divide their vote is free to do so (again, use "Other").
That's the purpose of the "Other" choice, which allows you to say what you want.That sounds good in theory, but does it work in practice? People voting are lazy.Then they don't care that much about the result, most likely.
Implementing the R4RS low-level system is less than trivial in a syntax-case system. It consists mostly of repackaging some already existing syntax keywords and procedures in a library. So you can effectively consider it widely implemented.Fair.Adding it to an existing ER system is doable when the ER system has a mechanism to get unhygienic macros right.Not so fair, since very few ER macro systems do so.
How hard is it to add to a system with only define-macro, like S9 from Empty Space, or only define-macro and syntax-rules, like Bigloo?
Voting for identifier-syntax (excluding the `set!` case) implies that identifier-syntax macro names in operand position are macro uses.You probably mean that "macro names in operand position are macro uses". The notion an "identifier-syntax macro name" is not very interesting in itself.Identifier-syntax macros are necessarily visible in operand position, and are understood as visible in operator position too. This is an upward compatible extension, since a macro name in operand position in R[57]RS is an error, as it is not an expression.
And what about (foo . bar) when foo is a macro keyword? Would it be a macro use? It is in R6RS but not in R7RS.What use is there for such a thing? (foo . bar) is not a function call either.
- What is meant by "SRFI 17 or identifier-syntax"? How are they related? (See also my latest private email on this topic.)You were right to say that SRFI-17 ycan't be defined on top of the two-argument form of identifier-syntax calls. But they provide essentially the same function, generalized `set!`, and so can appear as alternative proposals. (I note that Chez, Guile, Larceny, and Sagittarius support both.)It seems to be that they are more orthogonal to each other than alternatives.Can you explain further? What I meant by "essentially the same function" is that you can add (set! (leg dog) 'new-leg) to Scheme either by defining `leg` and `set-leg` as a SRFI 17 getter-setter pair of functions, or by defining an identifier-syntax macro `leg` that expands to calls on functions `leg-ref` and `set-leg`.
I have for the moment moved this to Morpheus too, leaving only single-clause identifier-syntax like (define-syntax leg (identifier-syntax (leg (leg-ref dog)))). (By the way, this is equivalent to CL's (define-symbol-macro leg `(leg-ref dog)), which of course is not hygienic.)
To quote the WG2 charter: "When deciding which features to include in the language, working group 2 should consider all features provided by R6RS Scheme, and all criticisms of those features. Insofar as practical, the language should be backwards compatible with an appropriate subset of the R6RS standard."Can you explain what this is supposed to mean in practice?Like everything in the charter, it means what I say it means, unless someone wants to appeal from my decision to the WG, in which case my decision is affirmed or overridden by majority vote. If someone wants to appeal further, the Steering Committee has the final word. (Of course, the SC can also fire me, in which case all bets are off.)As the size and scope of R7RS-large will be much bigger than the size and scope of any R6.1RS,I'd think that would be up to the R6.1RS WG. There is no reason why some of the R7RS libraries, portable and otherwise, should not be considered for inclusion. I don't know this for sure, but I think there might have been more if not for the artificial 24-month limit set by the SC for the first draft (which R7RS has carefully ignored).
I now see what I said, thanks to your link. I was young and foolish....
The latter is certainly true. But what would it mean if the majority voted for "ER macro transformer" without any further qualification?
To make some hopefully helpful proposal, what about the following questions (that are mostly not alternatives) together with some notes that are hopefully not biased:
The question was whether it is, in principle, widely implemented. If you count syntax-case in this regard, you can count R4RS as well.
"Identifier-syntax" is a keyword in R6RS that allows you to create such macros, but in general such a macro will have to be written with syntax-case or er-macro-transformer (for the same reason that syntax-rules, in general, do not suffice).
In R6RS, `(set! (leg dog) 'new-leg)` is a syntax violation and never a macro use.
As `(set! <id> <expr>)` doesn't touch SRFI 17, it should not be moved but discussed with the rest of the macro system, IMO.
Can you remind us of what 24-month limit you are talking about?
The question was whether it is, in principle, widely implemented. If you count syntax-case in this regard, you can count R4RS as well.Distinguo. The question is whether it is *actually* widely implemented. (This applies to non-portable proposals that are not explicitly written as a spec for a bridging implementation, like SRFI 170. Portable features are not held to the same standard, since they do not need to be implemented, only packaged.)Granted, if we have either syntax-rules or SRFI 211 ER in the standard, it will be portable, so I'm putting it in Morpheus, with the understanding that if either of those pass it will be moved to a portable docket (as will some other things).
"Identifier-syntax" is a keyword in R6RS that allows you to create such macros, but in general such a macro will have to be written with syntax-case or er-macro-transformer (for the same reason that syntax-rules, in general, do not suffice).Portably, certainly. But after all, `syntax-rules` is implemented by systems that don't provide either low-level module system. You have more experience with this than I, but I suppose the same is true of identifier-syntax.
As `(set! <id> <expr>)` doesn't touch SRFI 17, it should not be moved but discussed with the rest of the macro system, IMO.Done.
Can you remind us of what 24-month limit you are talking about?The R6RS charter, <http://www.r6rs.org/charter/charter-mar-2006.txt>, whose first version was dated in 2004-01, says: "The Editors should produce a draft standard core Scheme, a draft module system, and a draft set of initial libraries within 24 months of the Editors' establishment." (I'm actually quoting the final draft of 2006-02, as the first draft is not on r6rs.org.) The first draft of R6RS was published in 2006-09, 30 months later. In the WG's emails, there are also many references to "we can't do that, we don't have enough time"The R7RS WG1 charter sets the limit at 18 months for the first draft and 24 months for the final draft: it took approximately three years to the final draft. The WG2 charter said 24 months for the first draft, and we have been working on it since 2013 when WG1 wrapped up.
Anyway, prolog has trouble with expressivity. It's got the fatal flaw that it only supports two possible valuations: true, and false. Nothing else, whatsoever. The whole point of things like srfi-213, and (cough cough) ideas like "dictionaries" is that they allow you to wedge arbitrary valuations onto expressions, instead of having to settle for true/false as the only allowed values.
I notice that you used the word "pipeline" in describing the latest srfi-221 and srfi-158 implying that you think of generators as composable things that process data. The generators are bits of plumbing, the data that they act on is the "water" flowing through that plumbing.
And, if there's something that we've learned about graphs, it's that they need a good query language to go with them. Prolog ain't that. If prolog was enough, then things like SparQL and GraphQL would not exist. There's a reason why new stuff gets invented.
Hello Linas et al.
As far as I know, except Linas, I am the most knowledgeable about the
intersection of Scheme, database engineering, opencog, and the
atomspace. I want to add "sadly" to the previous sentence because I
would be glad to be challenged (on matters that do not relate to
commercial or marketing success or even social credibility).
I understand this thread is about the AtomSpace, and the rework of the
AtomSpace. Here is quote from the opencog wiki about the AtomSpace:
> The OpenCog AtomSpace is a knowledge representation (KR) database and the associated query/reasoning engine to fetch and manipulate that data, and perform reasoning on it. Data is represented in the form of graphs, and more generally, as hypergraphs; thus the AtomSpace is a kind of graph database, the query engine is a general graph re-writing system, and the rule-engine is a generalized rule-driven inferencing system. The vertices and edges of a graph, known as Atoms, are used to represent not only "data", but also "procedures"; thus, many graphs are executable programs as well as data structures. These Atoms, which are permanent and immutable, can be assigned fleeting, changing Values to indicate the truth or likelihood of that atom, or to hold other kinds of transient data. The AtomSpace enables flow-based programming, where Atoms represent the pipes, and Values are what flows through the pipes.
>
> https://wiki.opencog.org/w/AtomSpace
Le ven. 6 août 2021 à 13:16, Lassi Kortela <la...@lassi.io> a écrit :
>
> On 06.08.2021 14.07, Linas Vepstas wrote:
>
> > I work with a system that stores s-expressions in a database.
That is a mistake. The data stored in the atomspace database can have
a primary representation that can be serialized to an s-expr. That is
different from "everything is an s-expr".
> > Like all
> > good databases, these can be added and removed at any time, and It has
> > a pattern-matching system, so that users can search for what they
> > want. Very loosely, very roughly, it is syntax-case-like, but, of
It is still unclear to me whether the current AtomSpace supports
recursive possibly cyclic pattern matching.
What is clear is that
syntax-case does not support that.
> > course, at run-time, because the collection of s-expressions is
> > constantly changing. Over the years, it's gotten quite fancy, being
> > driven by user demands.
What the user demands is unclear to me.
> >
> > The question is: would it be possible to build such a system in pure
> > scheme, using one of the proposed macro systems to perform the
> > term-rewriting? That is, given a collection of s-expressions, find the
> > ones that match, per pattern-matcher, apply the transformations, and
> > plop the result back into the database?
I assume plop means "record" or "store" or "save" in the database.
Query, Transformation and Plop (QTP) really sounds like
Extract-Transform-Load (ETL). As far as I know, recording every QTP in
the atomspace, in the schema of the current atomspace is a mistake.
> >
> > (My system has a bunch of non-scheme oddities, e.g. all s-expressions
> > are typed, and each one is globally unique: it is impossible to store
> > two identical s-expressions (even alpha-convertible ones).
It is unclear to me how alpha conversion is applied to the data or the
code. Or even the data of the code stored in the AtomSpace.
> > One very
> > very important feature is the ability to ask and answer the question:
> > given any s-expression, find all of those that contain it.
That really depends on the query logic.
The s-expression
representation of domain data and the representation in the database
can be much different. The s-expr representation of the query (aka. a
DSL) is the very last question that should be asked / answered.
> > The current
> > code-base is in C++, with guile and python wrappers.
I already asked to support my work to rewrite the AtomSpace with Chez
with a specific set of problems that the database should solve. C++ is
difficult. Guile and Python are slow. Make it work, make it
maintainable, make it fast.
> > I'm asking,
> > because this has proven to be useful enough, that I think the general
> > idea should be more wide-spread.
After much work around opencog and the atomspace I still do not
understand what is that "general idea" outside the Artificial General
Intelligence system.
> > I have heard of people implementing
> > datalog (the data subset of prolog) in scheme, but they did not seem
> > to have any pattern matcher,
datalog is a pattern matcher.
Somewhat unrelated but possibly
interesting https://research.google/pubs/pub48190/
> > and it wasn't scalable/fast.
See the above google paper link.
> > BTW, some,
> > but not all of my s-expressions are executable/evaluatable. Thus,
> > after pattern matching, not only is there a term-rewriting step, but
> > it is followed by an execute/evaluate step.
Again bundling extraction, and transformation (and possibly loading
the result) is a mistake, it should be opt-in at user demand.
> > Apparently, graphQL for
> > javascript is a related concept. Note that graphQL has become very
> > popular.
Forget about GraphQL. GraphQL is not an algorithm, it is merely a
surface syntax for a neighbor query. Like I wrote before, the query
DSL is the last problem that should be solved. Getting together
example queries can help narrow / explain what problem must be solved,
but once you settle on a primary and secondary representation in the
database, a more powerful / fine-tuned DSL can emerge.
> > However, in javascript, all structures are always named;
GraphQL is usable and used in many programming languages. It is a
stringified query language like SQL. It is possible I am missing your
point.
> > whereas all of my structures are always anonymous (and you have
> > several choices for naming, if you really need to name something.).
> > Thus, my system is far far more like scheme, than it is like javascript.)
Yes, data in the atomspace can be anonymous, but you still can query
for "what is under the table" even if the results were added without
human supervision, and retrieve the uid of the object(s) under the
table.
Hence, you could use graphql for that particular query.
>
> Scheme has traditionally had (match ...) for pattern-matching at
> runtime. If you want to pattern-match using a macro, and the patterns
> vary at runtime, you'd have to use (eval ...).
>
You can implement `match` logic with pattern combinators. So far, I
did not manage to make it work with cyclic data, and as far as I
understand from a performance point of view, the general case is a
cursed problem.
On the subject of choosing a database:
- What guarantees do you need. Question all the properties of ACID:
Atomic, Consistent, Isolation, Durability. Look into BASE. You do not
necessarily need ACID or BASE, but it is a good basis that is well
documented to know where you want / need to go.
- What is the size of the data?
- What is the shape of the data?
Are they well defined types?
Are they
polymorphic types
or heterogeneous shapes?
- Workload: Write-once then Read-only, mostly reads, mostly writes, a
mix of both. Answer also the question how fast or slow data can be
written or read.
- Querying: What queries look like: recursive / deep, columns or rows,
or neighborhood queries (like graphql and SQL without recursive
queries). Again what is the expected time to respond.
ref: https://stackoverflow.com/a/68608928/140837
--
Amirouche ~ https://hyper.dev
--
You received this message because you are subscribed to the Google Groups "scheme-reports-wg2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scheme-reports-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scheme-reports-wg2/CAL7_Mo_gHVxfpkG%3Ddav9XDo-J9SVeauzkHBXrNq6XabN-66dBA%40mail.gmail.com.
On 7 Aug 2021, at 10:11, Marc Nieper-Wißkirchen <marc....@gmail.com> wrote:
> To make some hopefully helpful proposal, what about the following questions (that are mostly not alternatives) together with some notes that are hopefully not biased:
>
> 1. Do you want to have a basic version of er-macro-transformer that allows one to write procedural hygienic macros in R7RS-large? (Note: This will include basically all versions of er-macro-transformer found in existing implementations.)
> 2. If an er-macro-transformer system is included in R7RS-large, do you want that it supports writing unhygienic macros? (Note: This will rule out a number of existing implementations.)
> 3. If an er-macro-transformer system is included in R7RS-large that supports writing unhygienic macros, do you want raw symbols in the macro output to be closed in the use environment instead of causing undefined behavior?
> 4. If an er-macro-transformer system is included in R7RS-large, do you want that the sameness of identifiers can be tested with `eqv?`? (Note: This basically rules out interoperability with syntax-case.)
> 5. Do you want the low-level macro system of R4RS to be included in R7RS-large? (Note: This is basically the syntax-case system without syntax-case and pattern variables.)
> 6. Do you want the full syntax-case system as described in R6RS to be included in R7RS-large? (Note: This question does not touch what constitutes a macro use.)
> 7. Do you want to have a version of with-ellipsis (see SRFI 211) included in R7RS-large so that R7RS's syntax-rules can be easily expressed in syntax-case?
> 8. Do you want that a single keyword (not in operator position) can constitute a macro use? (Note: Informally, this is known as "identifier syntax".)
> 9. Do you want that a keyword as the first argument to `set!` can constitute a macro use? (Note: Informally, this is known as "variable transformers".)
> 10. Do you want to have no limits on what constitutes a macro use as in section 9.2 of the R6RS? (Note: This implies a positive answer to questions 8. and 9.)
> 11. Do you want `identifier-syntax` as a convenient form to implement macros that can be used outside operator position? (Note: A positive answer here implies at least a positive answer to question 8.)
> 12. Do you want R7RS-large to support both er-macro-transformer and syntax-case? (Note: There are currently few implementations that support this. A positive answer here rules out question 4.)
> 13. Do you want R7RS-large to make only one of the two systems mandatory? (Note: A positive answer here obviously rules out a positive answer to question 12, and vice versa.)
> 14. Do you want R7RS-large to support unhygienic macros? (Note: A positive answer here rules out a negative answer to question 2. unless questions 5. and 6. are answered positively.)
> 15. If the syntax-case system is included in R7RS-large, do you want to impose that all syntax objects are always fully unwrapped? (Note: While this makes syntax-case closer to er-macro-transformer, this will rule out most existing implementations and some otherwise pleasant properties of syntax-case are lost.)
>
> I know that this is a long list of questions but I don't think for the worse as these questions have to be considered and answered by every voter while making their decision anyway.
While this is certainly thorough, and may in fact be close to the best possible form of the ballot, I feel many of my own preferences, at least, are highly conditional on what the consensus of the WG on other questions is. I should note I feel that implementor voices are crucial in all of the questions about macro systems, since as John notes it is essentially *the* question about the one non-portable feature that opens the door to making lots of other things possible, and thus may ultimately decide the credibility of the R7 process in the eyes of both R5 and R6 implementation maintainers. Also, unlike non-portable features which are non-portable e.g. just because they need an FFI, or OS interface access, which can be given bridged implementations, macro systems are also the one non-portable feature which potentially require serious compiler hacking to implement. Therefore it is doubly important to try to get implementation *maintainers* involved and not merely *users* attached to different implementations — these voices have thus far largely been missing from this discussion.
For example, considering what the basis of the system is, I (as a Scheme programmer, not implementor) would rank the options syntax-case > R4RS > explicit renaming. But if explicit renaming is defined as in SRFI 211 such that it has proper hygiene and can correctly implement syntax-case, or if we adopt syntax-case outright, I think we can toss out R4RS altogether as a redundant proposal.
But the SRFI 211 form of explicit renaming is also completely unimplemented.
(Marc, can implementations which have both explicit renaming and syntactic closures implement your ‘correct’ form of explicit renaming by using the latter to hack the extra hygiene features into the ‘simple’/incorrect form? I know you did this for syntax-case in Chibi …)
And if it’s possible to implement syntax-case in terms of the SRFI 211 form of explicit renaming, presumably syntax-case can also be implemented in terms of the R4RS system? Am I correct?
Another question: Should it be possible to implement identifier syntax using syntax-rules patterns, as you implemented for Chicken, but (as I recently learned) R6RS forbade?
If so, I think `identifier-syntax` itself is redundant.
And an issue: I would like to vote against any and all forms of generalized set!, but since SRFI 17 and the identifier-syntax forms are split out here, I feel I can’t do that.
On 8 Aug 2021, at 15:33, Marc Nieper-Wißkirchen <marc....@gmail.com> wrote:
> Unfortunately, a lot of representatives of major R6RS systems have remained silent in discussions on R7RS-large, so we may have to do some guesswork. Alternatively, one could ignore these systems but I don't think this would lead to the best outcome for (future) users of R7RS-large. So, IMO, one should keep them in mind.
>
> I would also like to add that the issue of "serious compiler hacking", which may or not may be needed thanks to existing pluggable implementations, is probably not the major issue. After all, whatever macro system has to be implemented only once, so even if it took, say, four weeks of developer time, it would pay off.
Nonetheless, our goal in designing R7RS is surely to maintain the respect and interest of the implementers who were alienated by R6RS because of the high bar it set in terms of adopting support for it, in terms of what they already had. We can assume any implementation or implementer of R6RS will want syntax-case to be the one macro system adopted by R7RS (at least if we do decide to have only one and only one low-level macro system in the standard). What people think who have thus far only implemented R5RS and/or R7RS small is the real question I’d like to know the answer to.
> What the more serious issue is, I think, is that it may make it impossible for implementations to provide an R7RS-large-conformant mode that still supports all proprietary legacy extensions of R7RS-small of that particular implementation. Personally, I think that adding such a requirement would be opposed to the success of R7RS-large in the long run, but some implementers may see it differently.
This is more or less exactly my point in wanting to get implementers involved.
> We should also keep in mind that new implementations will be developed.
Certainly, but I don’t think it’s so helpful to consider their needs. Whatever we choose can be adopted by a new implementation which explicitly sets out to follow R7RS (as long as we don't require them to solve the halting problem!).
>> And if it’s possible to implement syntax-case in terms of the SRFI 211 form of explicit renaming, presumably syntax-case can also be implemented in terms of the R4RS system? Am I correct?
>
> The difference between syntax-case and the R4RS system is the syntax-case pattern matcher. This is already essentially part of any R7RS-small system because syntax-rules needs the same matcher. However, syntax-case adds the concept of pattern variables. In order to be able to implement syntax-case as macro in the R4RS system (or in some form of ER), one needs something like SRFI 213. (The question of adding that is, in principle, completely orthogonal to the question of the macro system, but it is certainly nice to have the possibility of implementing syntax-case as a library form.)
If one added with-syntax to R4RS (which syntax-case typically defines in terms of the pattern matcher, thus tightly integrating pattern variable binding with pattern matching, which I guess is the core of Alex's objection), SRFI 213 isn’t needed though, is it? In other words, instead of considering the big complicated pattern matcher the primitive pattern variable binder and implementing with-syntax on top of it, could one not consider the simple with-syntax a primitive and implement the pattern matcher on top of it and the other features in R4RS’s system?
> Implementing syntax-case on top of only SRFI 211 ER even with SRFI 213 is still not possible in the strict sense because a syntax-case transformer is just a transformation procedure. For example,
>
> (define-syntax foo (lambda (x) 42))
>
> does not even invoke any procedure that could invoke `er-macro-transformer`.
Ah, yes. The only way to fix this I guess would be to add another analogue to {er,ir,sc,rsc}-macro-transformer around the definition procedure for macros using the syntax-case (or R4RS) system, so your example would be formally an error and have to be written:
(define-syntax foo (syntax-transformer (lambda (x) 42)))
or the like. Reading Alex’s post, the lack of an analogous form such as this was another one of his problems with the syntax-case system (as by having no such wrapper it essentially defines itself as the ultimate macro system to rule all others), so perhaps this would not be a bad idea even though it even further increases the verbosity of any syntax-case macro.
> With offering both a (restricted) syntax-rules and identifier-syntax (both as simple wrappers around the more general syntax-case), R6RS probably got it right.
Okay, fine.
>> And an issue: I would like to vote against any and all forms of generalized set!, but since SRFI 17 and the identifier-syntax forms are split out here, I feel I can’t do that.
>
> What do you mean by generalized `set!`? SRFI 17 or macro uses with `set!` in the keyword position (aka variable transformers) or both?
Both. Specifically, I think:
• the first argument to set! should always have to be an identifier
• if that identifier happens to be the name of a macro keyword, set! wipes the macro definition and makes it a regular variable
I believe this is consistent with R7RS small, even if not with R6RS. (Although I just tried it in Chibi and it segfaulted, and no other implementation I tried seems to actually behave like this either — they think it’s an error to set! any macro keyword. Reading the definition of set! in R7RS small, I don’t really understand why.)
> When we allow keywords in operand position as macro uses, leaving out variable transformers would be a stupid mistake. For example, if we have keywords in operand position as macro uses, we may want to use them to define fast versions of procedures with optionals and keywords:
>
> (define/optionals (foo bla : blubb ...)
> ...)
>
> But to make this transparent, we need to support a subsequent `(set! foo 42)`, and for this we need variable transformers.
I guess it depends what you what the `(set! foo 42)` to do ;-)
Linas, thanks to the awesome answer. I think it is better we move the
conversation in private or the opencog google group. Let me know.
What people think who have thus far only implemented R5RS and/or R7RS small is the real question I’d like to know the answer to.
Both. Specifically, I think:
• the first argument to set! should always have to be an identifier
On 8 Aug 2021, at 17:02, Marc Nieper-Wißkirchen <marc....@gmail.com> wrote:
> In this case, `foo` would remain bound to the same keyword but that would expand into `42` from then on.
>
> Scheme has lexical scope that comes structured in blocks. In each lexical scope, an identifier is either a variable, or a keyword, or unbound. (Or of some other type, like a pattern variable.) Your `set!` semantics would only make sense if the type of Scheme identifiers was dynamically and not lexically determined.
Yes, indeed, you’re correct. D’oh. I now see the argument that the identifier-syntax variety of generalized set! (where the first argument to set! is still restricted to be an identifier) is likely necessary. (A very ugly way to avoid this would be to require identifier macros to expand to another identifier in all contexts if they’re supposed to be mutable bindings, and *that* identifier then gets rebound if it’s the first argument to set!. This turns identifier syntax, at least without the possibility of context-sensitive expansion at least, into little more than glorified aliasing.)
On 8 Aug 2021, at 15:33, Marc Nieper-Wißkirchen <marc....@gmail.com> wrote:
> A side remark on SRFI 17: Before anyone votes on this, don't forget to read the arguments of Matthias Felleisen on the SRFI 17 mailing list carefully. While the tone with which the discussions there were held may take some getting used to, the truth value of his words that SRFI 17 may be based on and promotes some deep misunderstanding of the role of `set!` is independent of that.
I have taken a look at his posts, and his arguments seem to mostly be that SRFI 17 (in an early draft) was unclear about the mechanism, which apparently was resolved in later drafts and the final spec? Or can you point to another specific thread?
So if you were with 100 other people and they all jumped off the cliff, you would jump, too? I have always hoped that Schemers developed things because they were right not because the majority did it. Here "right" means there is supportive pragmatic evidence and an underlying theory. [...]We should always keep this quote under our pillows when we dream of new features.
**
Nonetheless my feeling is that SRFI 17 setters don’t compose well (though the worst of this problem is mitigated by the fact that it does already specify that there are already setters for cXr up to as many X as Scheme provides — but these are ‘fake’, because of course there is no set-cadr! for example, and also no setters for SRFI 1 first, second, third, etc, nor for any other number of procedures which might *appear* settable but aren’t. I guess this is what ‘promotes misunderstanding about set!’).
> The advantage of a standard is that all its parts can fit together and
> it can be documented and understood in one go.
>
> It’s the "batteries included" approach.
>
> A package manager is great, but looking at the horror of tiny packages
> of Javascript, I see the strength of having a strong set of always
> available libraries in uniform style.
>
> You can more easily understand them all together, when your assumptions
> from other libraries just work in the other libraries.
Strongly agreed, but RnRS is too rigorous a process for creating such
libraries. We should start another design process for non-core stuff,
more lightweight than RnRS and SRFI.
On Mon, Aug 9, 2021 at 12:02 AM Marc Nieper-Wißkirchen
<marc....@gmail.com> wrote:
>
> The claim of the "ultimate macro system ruling all others" is just plain wrong. First of all, the idea that procedures can be macro transformers is orthogonal to syntax-case/syntax (as my above example shows, neither appears). This only says that a transformer can be given by a procedure mapping an input syntax object into an output syntax object (which is, IMO, pedagogically a very good thing). Secondly, already R6RS knows a different type of transformer, namely variable transformers, and adding more transformer types like ER macro transformers is straightforward and doesn't need to cause any incompatibilities. By the way, this has already been discussed at length between Alex and some people supporting R6RS when they were still on board at the beginning of the R7RS-large process. Adding something like `syntax-transformer` would help no user but only alienate some.
Discussed, yes, but I never agreed with the other side.
It would help Chibi remove one of it's biggest warts, in the hack that
allows syntax-case to co-exist with ER macros.
And it would help implementations that wouldn't consider adding such a
hack in the first place.
The alienation for R6RS users is minimal. If you want you can even
define a define-syntax that implicitly wraps its argument with
syntax-transformer. No such trivial user-space workaround exists in
the other direction.
On 8/9/21 12:43 AM, Daphne Preston-Kendal wrote:
> On 8 Aug 2021, at 15:33, Marc Nieper-Wißkirchen <marc....@gmail.com> wrote:
>
>> A side remark on SRFI 17: Before anyone votes on this, don't forget to read the arguments of Matthias Felleisen on the SRFI 17 mailing list carefully. While the tone with which the discussions there were held may take some getting used to, the truth value of his words that SRFI 17 may be based on and promotes some deep misunderstanding of the role of `set!` is independent of that.
>
>
> I have taken a look at his posts, and his arguments seem to mostly be that SRFI 17 (in an early draft) was unclear about the mechanism, which apparently was resolved in later drafts and the final spec? Or can you point to another specific thread?
If I recall (and haven't re-read the thread) the argument was that 'set!' is about changing
bindings (variables) and should not be overloaded to change properties of objects.
(I disagree, parly because you can just as validly view a variable as a property of a
frame object.)
Claiming this is a "deep misunderstanding" is elevating a preference to a fundamental
principle. I think it is a distraction. The question is: does using SRFI-17 set! make
the code easier to read? (I believe it does.) Does it lead more or fewer errors or
misunderstandings of the code? (I see no reason to believe so.) Does the fact that most
other languages similarly overload assignment make it easier (or at least more familiar)
for new Scheme users? (I don't know, but it seems plausible to me.)
It might be preferable if set! bindings were lexical bindings that could be imported.
Common Lisp supports that, in the sense that (setf FOO) is a pseudo-symbol in certain contexts.
One could define
(set! (foo x y z) value)
as
($setter$-foo value x y z)
and then one can import and lexically bind $setter$-foo.
Alternative, one could use compound symbols, as in Common Lisp and Kawa: setter:foo
(There are some complications relating to hygiene that might require datum->syntax and syntax-datum.)
On Mon, Aug 9, 2021 at 8:57 PM Marc Nieper-Wißkirchen
<marc....@gmail.com> wrote:
>
>> It would help Chibi remove one of it's biggest warts, in the hack that
>> allows syntax-case to co-exist with ER macros.
>> And it would help implementations that wouldn't consider adding such a
>> hack in the first place.
>
> It's not true that any hack is needed for the coexistence of ER macros with transformer procedures. It's enough to make sure that evaluating the er-macro-transformer procedure returns an object of a type that is disjoint to (ordinary) procedures. This is what Unsyntax does, for example. I believe that that's a straightforward and very clean solution.
>
> The case with Chibi is special because you chose to use procedure values also for the underlying implementation. It's that choice (that wouldn't have been necessary and that is not exposed to the user through er/sc/rsc-macro-transformer) that has forced me to hack around it to add syntax-case.
All native ER (and synclo) implementations represent macro
transformers as procedures. Unsyntax is the first I've heard of a
system which does otherwise.
> It would be different if Chibi's (lambda (form use-env mac-env) ...) were part of just another macro facility to be standardized. If that were the case, then we would have some incompatibility with R6RS.
>
>> The alienation for R6RS users is minimal. If you want you can even
>> define a define-syntax that implicitly wraps its argument with
>> syntax-transformer. No such trivial user-space workaround exists in
>> the other direction.
>
> Can you explain what you exactly mean by your last sentence?
Sorry, the incompatibility exists at the implementation level, not the
user level. The user has no workaround only in the sense that the
implementation is unlikely to hack their internals to support
syntax-case to begin with.
Note also in most implementations the underlying macro transformer
signature is leaked anyway, and we can't stop some people from taking
advantage of this (e.g. in third-party implementations of
ir-macro-transformer for Chibi). So there would be breakage there as
well, but that's OK - I don't consider (lambda (form use-env mac-env)
...) a guarantee anyway, and would consider adding more parameters for
more context (e.g. expansion history, expected number of returned
values, etc).
On Tue, Aug 10, 2021 at 3:46 PM Marc Nieper-Wißkirchen
<marc....@gmail.com> wrote:
>
> And it should be noted that procedures as transformers were already in the 1991 appendix of the R4RS. The definitions of the ER and SC macro facilities of the same year (Clinger, Hanson) are fully compatible with R4RS because they do not mandate nor expose any implementation as procedures.
Syntactic-closures were introduced by Bawden and Rees in 1988,
predating the R4RS, and exposed the transformers as procedures
directly.
The later revision by Hanson presumably introduced the wrapper layer
to distinguish between normal and reverse syntactic-closures, though
the internal implementation was and still is incompatible with R4RS.
> It was a conscious choice by later implementations to add an incompatibility with R4RS and the later syntax-case system. Anyway, it should be simple for every implementation to revert that unfortunate decision.
Yes, we can just tell the implementors to change their system
internals, but we want to tread lightly there. Showing too much
disregard for existing implementations is a good way to ensure they
don't even try to adopt syntax-case. On the other hand, there may be
a slim chance of adoption in those cases anyway.
The hard things to add (if not already present) are things like `syntax`, `datum->syntax` and a proper implementation of `bound-identifiers=?`. These I would see as dealbreakers if implementers are unwilling to adapt (no pun intended) their expanders. Getting the external interface to R4RS/syntax-case right is flyspeck compared to it.
I think the CL / SRFI 17 format (set! (car x) y) as equivalent to (set-car! x y) is actually very nice, and more important than (set! car-x y), which must be defined for each x.As for the former, read Felleisen.
As for the latter: Why would one want to do it?
On Mon, Aug 9, 2021 at 2:04 AM Marc Nieper-Wißkirchen <marc....@gmail.com> wrote:I think the CL / SRFI 17 format (set! (car x) y) as equivalent to (set-car! x y) is actually very nice, and more important than (set! car-x y), which must be defined for each x.As for the former, read Felleisen.I have now read the whole email archive for SRFI 17 and found it extremely unedifying (as did Bothner by the end), but I have to agree with <https://srfi-email.schemers.org/srfi-17/msg/2778585/>, in which he asks ironically "Do they teach condescension at Rice?" I have observed that there is a tendency for professors to divide the world into other professors and students, even outside the classroom.
At any rate, when the debate gets focused, it is about "Shall set! refer to both variable binding and data structure mutation, on the grounds that variable binding *is* the mutation of a behind-the-scenes data structure, or shall set! be reserved for variable binding and something else be used for generic data structure mutation?" Each basically appeals to intuition, and since their intuitions contradict one another, that is no help.
As for the latter: Why would one want to do it?I have no clue.
Why does two-clause identifier-syntax support it?
It doesn't support the setters of SRFI 17.
What it does support is something like the following (simplified to one clause of just one form):
On Tue, Aug 10, 2021 at 6:55 PM Marc Nieper-Wißkirchen
<marc....@gmail.com> wrote:
>
> Am Di., 10. Aug. 2021 um 11:16 Uhr schrieb Alex Shinn <alex...@gmail.com>:
>>
>> On Tue, Aug 10, 2021 at 3:46 PM Marc Nieper-Wißkirchen
>> <marc....@gmail.com> wrote:
>> >
>> > And it should be noted that procedures as transformers were already in the 1991 appendix of the R4RS. The definitions of the ER and SC macro facilities of the same year (Clinger, Hanson) are fully compatible with R4RS because they do not mandate nor expose any implementation as procedures.
>>
>> Syntactic-closures were introduced by Bawden and Rees in 1988,
>> predating the R4RS, and exposed the transformers as procedures
>> directly.
>
> There's no mention of define-syntax in that paper so the relationship of their expanders with respect to R4RS+ define-syntax is not even defined. That's why I didn't cite this paper as it seems irrelevant (not for the development of hygienic macro facilities but for the question at hand).
[We're getting off-topic so should probably carry this to a separate
thread, but I want to address this misinformation.]
You seem to be making the argument that the R6RS macro transformer
signature was the first and only signature, and that any alternative
approaches were willfully different and now is the time for them to
get back in line with R6RS. You're basing this on the fact that the
low-level macros described in the appendix to the R4RS shared the same
signature. However, that was just used as an example in R4RS, which
was very careful to note that it "is but one of several low-level
facilities that have been designed," explicitly cites Bawden and Rees'
work on syntactic-closures as an earlier influence, and states "The
macro committee has not endorsed any particular low-level facility."
That example low-level system was notably removed from the R5RS.
Even if the R6RS-style signature were "first," the disregard for
existing alternatives and unwillingness to even consider a compromise
is the sort of "my way or the highway" attitude that was so
off-putting about R6RS in the first place.
Agreed, not every impl will support all of R7RS-large, and maybe they
are unlikely to support syntax-case anyway. Note though, that some
impls may accept small patches to make third-party syntax-case support
possible. In this case, adding things like preserving the renamer in
wrapped syntax (necessary for `datum->syntax`) might be accepted in
the core, but changing the macro signature is much less likely (and
would be dangerous, touch a lot of code, and possibly break things for
users). So from a practical perspective, you have the difficulties
reversed: changing the signature is the hard part.
On Tue, Aug 10, 2021 at 3:17 PM Marc Nieper-Wißkirchen each x.It doesn't support the setters of SRFI 17.Right. The getter-setter relationship is between procedure objects; the `setter` function extracts the setter of a getter, both procedures.
What it does support is something like the following (simplified to one clause of just one form):I now understand what a two-clause identifier-syntax macro is: it's a macro (and therefore second-class) emulation of Zetalisp locatives (see <https://hanshuebner.github.io/lmman/fd-loc.xml>). This is not as simple to implement as Zetalisp pointer locatives, but it means the GC doesn't have to deal with pointers into the interior of a data structure. A locative is just a pointer, and a pointer can always be emulated using a getter-setter pair.
That is exactly what SRFI 17 does. (set! (car x) 32) does not expand to (set-car! x 32), although it is equivalent to it; it expands to ((setter car) x 32), where the procedure `setter` does a run-time lookup on the car procedure object and returns the set-car! procedure object. This has a perfectly good theory, of course, since it is just function evaluation with a little syntactic sugar.
But the meat of the debate is whether two different macro keywords are to be provided or just one. To which I say, "Who cares?"
On Wed, Aug 11, 2021 at 3:35 PM Marc Nieper-Wißkirchen
<marc....@gmail.com> wrote:
>
>> Agreed, not every impl will support all of R7RS-large, and maybe they
>> are unlikely to support syntax-case anyway. Note though, that some
>> impls may accept small patches to make third-party syntax-case support
>> possible. In this case, adding things like preserving the renamer in
>> wrapped syntax (necessary for `datum->syntax`) might be accepted in
>> the core, but changing the macro signature is much less likely (and
>> would be dangerous, touch a lot of code, and possibly break things for
>> users). So from a practical perspective, you have the difficulties
>> reversed: changing the signature is the hard part.
>
> I challenge these claims. Changing define-syntax so that it works with transformers of the form (lambda (stx) ...) was IMO by far the simplest part when I added these things to Chibi.
[Actually, your change broke some third-party code, I fixed this
yesterday. Note the core define-syntax is exposed again so it won't
work directly with syntax-case.]
Challenge accepted. Consider Chicken, for example. It supports
R7RS-small, but is unlikely to adopt non-portable changes made by
R7RS-large. However, it would be possible to implement syntax-case as
a third-party egg. The only thing you could not do is make
(define-syntax (lambda (x) ...)) work - you would need a wrapper
and/or a redefinition of define-syntax as done in Chibi.
On Wed, Aug 11, 2021 at 4:53 PM Marc Nieper-Wißkirchen
<marc....@gmail.com> wrote:
>
>> Challenge accepted. Consider Chicken, for example. It supports
>> R7RS-small, but is unlikely to adopt non-portable changes made by
>> R7RS-large. However, it would be possible to implement syntax-case as
>> a third-party egg. The only thing you could not do is make
>> (define-syntax (lambda (x) ...)) work - you would need a wrapper
>> and/or a redefinition of define-syntax as done in Chibi.
>
> How would you implement syntax-case (including pattern variables and datum->syntax and the syntax form and bound-identifier=? and so that it works seamlessly with the module system) portably in Chicken? That's a genuine question. When I just look at the (chicken syntax) module, I don't see enough primitives to do so.
What's needed is a way to associate auxiliary data (the renamer) with
renamed identifiers. Storing these directly in an identifier object
is easiest, of course, but you can also use global (ideally key-weak)
hash-tables.
> The third-party egg could, of course, just export the define-syntax wrapper you mentioned just as (chibi syntax-case) does it now.
Yes, that's what I said.
On Wed, Aug 11, 2021 at 11:48 PM Marc Nieper-Wißkirchen
<marc....@gmail.com> wrote:
>
> For a truly faithful implementation of syntax-case, you need quite a bit more. (And the code in Chibi is, for the same reasons a working approximation for a lot of use cases, but not a faithful implementation of SRFI 93/R6RS.)
My point was that one could implement Chibi-style syntax-case for
Chicken (and MIT, etc.).
If you argue that Chibi is not conformant, then we should be careful
to exclude mention of the existence of that from discussions of
syntax-case support.
But I'm not convinced of your example. I think it suffices to assume
if the syntax argument of datum->syntax is a bare symbol, then the
current lexical environment should be used (which is the normal
interpretation of ER macros to begin with).
Even if it were not possible without some internal changes, it can be
easier to get such changes accepted than to get the whole syntax-case
expander into the core.
So this is _not_ just a matter of
bikeshedding.
What absolutely can't be implemented without intrusive internal
changes is identifier syntax, so we should be sure to address that
separately.
> Used SRFI-42 and it’s no longer en-vogue? Soft trauma.
The major imperative for applying this care is in RnRS. It wasn't
applied in R6 and it's not being applied in R7. Someone has to say it.
It's also important to distinguish between interface and implementation.
We should make stable versions of the interface spec. If people want to
go back later and optimize an implementation, so much the better.
- Non-core libraries in SLIB
- Non-core libraries in R7RS-large
> But if you rely on some old version of a library and that version does
> not support http2, then you lost. You suddenly have to invest much more
> than expected just to keep your tool working with the changing
> environment.
I don't understand that. If a new protocol supports the same API as the
old protocol, then support can be added without changing the API. The
old API can be kept working with the new protocol.
--
You received this message because you are subscribed to the Google Groups "scheme-reports-wg2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scheme-reports-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scheme-reports-wg2/CAD2gp_Sz7gkw%3DMyWmAGhq12b-Kq90LvHk3BkwaRY%2BpBaU_zDjg%40mail.gmail.com.
Version numbers are necessary part of a good design. They are already
used in R6RS, in fact: e.g. (import (rnrs bytevectors (6))).
Apart from R6 compat, my major concern with "wielding power" in R7-large
(again, being firmly in camp 4) is that any RnRS that adds a feature
puts a moral obligation on future RnRS editions to also support that
feature. R6 put an obligation on R7 to carry all the new stuff, which R7
didn't want to do, causing the 6/7 split.