From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Marc_Nieper=2DWi=C3=9Fkirchen?= Newsgroups: gmane.lisp.guile.devel Subject: Re: Feature request: Expose `ellipsis?' from psyntax.ss Date: Wed, 14 Nov 2018 21:27:17 +0100 Message-ID: References: <875zwzmq4n.fsf@netris.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000066bc16057aa5c390" X-Trace: blaine.gmane.org 1542227152 17367 195.159.176.226 (14 Nov 2018 20:25:52 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 14 Nov 2018 20:25:52 +0000 (UTC) Cc: guile-devel@gnu.org To: mhw@netris.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Nov 14 21:25:48 2018 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gN1jO-0004Pn-Ve for guile-devel@m.gmane.org; Wed, 14 Nov 2018 21:25:47 +0100 Original-Received: from localhost ([::1]:34036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gN1lV-0005SL-Io for guile-devel@m.gmane.org; Wed, 14 Nov 2018 15:27:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gN1lD-0005MA-Km for guile-devel@gnu.org; Wed, 14 Nov 2018 15:27:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gN1l7-0002hT-Oi for guile-devel@gnu.org; Wed, 14 Nov 2018 15:27:37 -0500 Original-Received: from mail-pl1-f182.google.com ([209.85.214.182]:39809) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gN1l7-0002em-BY for guile-devel@gnu.org; Wed, 14 Nov 2018 15:27:33 -0500 Original-Received: by mail-pl1-f182.google.com with SMTP id b5-v6so8316598pla.6 for ; Wed, 14 Nov 2018 12:27:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=de3M0vq0szY//GgfgJ8T08kN7+LT/8lgyVgVTfmJ/FM=; b=OJuy3lqtMmOxR8UUBkKBaOesibU4YdiJFKSz9RTh4PMVpa4nzpt6RWK7bxDC/L7tVJ ElKt5QpMno+ZTjwpp6U0CZQPJnDk89CFTeaMB6BOJda6AbFn0EdrXFevj7LID7geOcY9 iKciFMIXg6nBws8XsXM/PHzKQsEnPsxxx4YHTqabyE2LowbL6ss4opwAvACdoXhvRK5U qJ2pv9Unt3uxK7qzyjsvorwfaOVX1Tc1+5zu300KOzf7W2utbIiGkqXO7ZrVrSSZ35CC mxsxxppaJntuIBG0JXPvE9uArnDrTGrUfsg/dlfwDvhuspdioXrX0IpDGg/qpv9tHZIC 7zJg== X-Gm-Message-State: AGRZ1gKTjfPmtOOXbiW8WmO2ejDuMX/R8hpeHBUB9r0ruPAfJ4PwYrxC YF+iHVVySzyqusVkvKCtA6sJeEDPWX+uW64jU7NIdgB5 X-Google-Smtp-Source: AJdET5cGTM7eggTx8ZosPqG/CWpzeA5Uqz17GeOA8hhPZ0TbdqPdALa18kMuo5gCxf6c8PZoDuTVlSPCbR7Xb0Vv/hY= X-Received: by 2002:a17:902:b943:: with SMTP id h3-v6mr3178216pls.124.1542227250034; Wed, 14 Nov 2018 12:27:30 -0800 (PST) In-Reply-To: <875zwzmq4n.fsf@netris.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.214.182 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.org gmane.lisp.guile.devel:19735 Archived-At: --00000000000066bc16057aa5c390 Content-Type: text/plain; charset="UTF-8" Hi Mark, thank you very much for replying so quickly. Am Mi., 14. Nov. 2018 um 20:11 Uhr schrieb Mark H Weaver : > > 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 --00000000000066bc16057aa5c390 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Mark,

thank you very much for replying so quickly.

Am Mi., 14. Nov. 2018 um 20:11=C2=A0= 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.=C2=A0 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?&= #39;, `bound-identifier=3D?' and `free-identifier=3D?' 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-ident= ifier?' and `free-identifier?' as procedures that can be called by = macro transformers easily. And so I think of `ellipsis?'.
=C2= =A0
> Thus, I would like to ask = to add `ellipsis?' to the list of procedures
> exported by Guile (like `identifier?` or `bound-identifier=3D?` alread= y
> are).

I'll need to think about how this could be exposed in the API.=C2=A0 It= 's not
as simple as exporting that procedure.=C2=A0 The 'ellipsis?' proced= ure 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 ha= ve.
'identifier?' and 'bound-identifier=3D?' only need the synt= ax objects.

I think I understand (pleas= e correct me if I am wrong): If we want to check whether `e' is the cur= rent ellipsis, we cannot simply look up the binding of `(datum->syntax e= '$sc-expand)' because the wrap of `e' may be different than th= e wrap of the, say, `syntax-case' or `syntax' form in which `e'= appears. So what we actually need is a procedure of two arguments: `(ellip= sis? e ctx)' returns `#t' if the identifier `e' is the current = ellipsis in the lexical environment of the identifier `ctx'.
=
-- Marc


--00000000000066bc16057aa5c390--