Re: syntax-rules question

[email protected] Tue, 3 Jan 2023 15:50:26 +0100
Newsgroups gmane.lisp.scheme.bigloo
Message-ID <[email protected]>
--=-=-=
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Joe,

Happy new year and best wishes for 2023.

> Hello, Manuel,
> I am porting SRFI-42 (Eager Comprehensions) to Bigloo. In doing this, I r=
an into a couple of problems. The first was that the default implementation=
 assumes that identifiers can start with colons (:) and this is not true fo=
r Bigloo; keywords start or end with a colon. I was able to address this in=
 the manner Alex Shinn did in his gauche implementation of SRFI-42 by renam=
ing. The next problem I ran into was a syntax-rules expansion problem. Due =
to the continuation passing style of the macros being used, symbols were be=
ing multiply prepended with the hygiene-mark (|hygiene.r5rs.mark|) but the =
current definition of hygiene-value only strips off a single instance of th=
e hygiene-mark. I was able to work around this by changing the definition o=
f hygiene-value to strip all occurrences of hygiene-mark not just the first=
. See below. However, I am not sure that this is correct from a hygiene per=
spective or not. Does this definition of hygiene-value call problems.
>=20
>=20
> (define (hygiene-value x)
> =A0=A0 (if (not (symbol? x))
> =A0=A0=A0=A0=A0=A0 x
> =A0=A0=A0=A0=A0=A0 (let ((s (symbol->string x)))
> =A0=A0 =A0=A0 (let loop ((s s))
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (if (substring-at? s hygiene-prefix =
0)
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (loop (substring s hygie=
ne-prefix-len (string-length s)))
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (string->symbol s))))))

My guess is that it should be correct but I do not remember how this
code works clearly enough to be a 100% sure. I have tried it, and what I
can say is that at least, this modification does not prevent the tests of
the recette directory to run successfully.

=2D-=20
Manuel

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEELgdDMTtUx/Mxl41xMMxQ5DtOwukFAmO0Q+AACgkQMMxQ5DtO
wuniJwf/QBEKiGqFzjlorjsMNIHFp6dIW/kOWSn/Q5tfwnwTPgVeevtHdigu8gOR
/psTrP62Id1mcbJYFKfXRSDf/oE9vKPMF1HeXWxJvueHxgwzlAzum9S1SZ7BHJ7C
uoByIsOv3Oo+/bHFS0Ao5ZifSKm6H47jX/xIqtI8OiHpbu0dGH/0OrgUKqC3lUa4
yBvK3UwmW1Y9BS55flfKnjlm9b4/aGoY+/J2vfq0iKYSz5v/Bafv8pm9qNOmCmIQ
/h+YMUIV3UHODpqDbbkLn0rgWWnRBp8dFq/FhZN68tzZvPjhoTm9wQildPS8g/mO
msVoTs/2fpRyP4z3HeMo1zZeDNq1oA==
=m/iH
-----END PGP SIGNATURE-----
--=-=-=--