From: "Marc Nieper-Wißkirchen" <marc@nieper-wisskirchen.de>
To: mhw@netris.org
Cc: guile-devel@gnu.org
Subject: Re: Feature request: Expose `ellipsis?' from psyntax.ss
Date: Wed, 14 Nov 2018 21:27:17 +0100 [thread overview]
Message-ID: <CAEYrNrRyHwWy34HK3S7JdVF_z1fA8Gy9gRR-=oex2AQz+QRnJg@mail.gmail.com> (raw)
In-Reply-To: <875zwzmq4n.fsf@netris.org>
[-- Attachment #1: Type: text/plain, Size: 2003 bytes --]
Hi Mark,
thank you very much for replying so quickly.
Am Mi., 14. Nov. 2018 um 20:11 Uhr schrieb Mark H Weaver <mhw@netris.org>:
> > The `ellipsis?' procedure in psyntax.ss does exactly this, but it
> > isn't available to user code. Re-implementing it is not possible
> > without accessing internal details like the special identifier #{
> > $sc-ellipsis }# and without resorting to hacks.
>
> Surprisingly, it actually _is_ possible to do it portably in any
> R[567]RS Scheme. See 'match-check-ellipsis' near the end of
> modules/ice-9/match.upstream.scm.
>
This is why I wrote "without resorting to hacks". :-) Like `ellipsis?',
`bound-identifier=?' and `free-identifier=?' can also be portably
implemented in R5RS, and I had to use all these tricks to provide a
portable implementation of SRFI-148. But it is nicer to have
`bound-identifier?' and `free-identifier?' as procedures that can be called
by macro transformers easily. And so I think of `ellipsis?'.
> > Thus, I would like to ask to add `ellipsis?' to the list of procedures
> > exported by Guile (like `identifier?` or `bound-identifier=?` already
> > are).
>
> I'll need to think about how this could be exposed in the API. It's not
> as simple as exporting that procedure. The 'ellipsis?' procedure is not
> able to answer the question by looking only at the syntax object; it
> also needs the macro-expansion environment 'r', which you do not have.
> 'identifier?' and 'bound-identifier=?' only need the syntax objects.
>
I think I understand (please correct me if I am wrong): If we want to check
whether `e' is the current ellipsis, we cannot simply look up the binding
of `(datum->syntax e '$sc-expand)' because the wrap of `e' may be different
than the wrap of the, say, `syntax-case' or `syntax' form in which `e'
appears. So what we actually need is a procedure of two arguments:
`(ellipsis? e ctx)' returns `#t' if the identifier `e' is the current
ellipsis in the lexical environment of the identifier `ctx'.
-- Marc
[-- Attachment #2: Type: text/html, Size: 2764 bytes --]
next prev parent reply other threads:[~2018-11-14 20:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-14 13:16 Feature request: Expose `ellipsis?' from psyntax.ss Marc Nieper-Wißkirchen
2018-11-14 19:10 ` Mark H Weaver
2018-11-14 20:27 ` Marc Nieper-Wißkirchen [this message]
2018-11-15 9:38 ` Mark H Weaver
2018-11-15 10:03 ` Marc Nieper-Wißkirchen
2018-11-15 10:59 ` Mark H Weaver
2018-11-15 19:41 ` Marc Nieper-Wißkirchen
2018-11-16 0:00 ` Mark H Weaver
2018-11-16 13:37 ` Marc Nieper-Wißkirchen
2018-11-16 23:36 ` Mark H Weaver
2018-11-17 15:03 ` Marc Nieper-Wißkirchen
2018-11-21 3:37 ` Mark H Weaver
2018-11-21 8:40 ` Marc Nieper-Wißkirchen
2018-11-21 16:09 ` Marc Nieper-Wißkirchen
2018-11-23 7:55 ` Mark H Weaver
2018-11-23 21:06 ` Marc Nieper-Wißkirchen
2018-11-23 20:25 ` Mark H Weaver
2018-11-23 21:28 ` Marc Nieper-Wißkirchen
2018-11-24 9:08 ` Marc Nieper-Wißkirchen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAEYrNrRyHwWy34HK3S7JdVF_z1fA8Gy9gRR-=oex2AQz+QRnJg@mail.gmail.com' \
--to=marc@nieper-wisskirchen.de \
--cc=guile-devel@gnu.org \
--cc=mhw@netris.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).