[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] export/rename
From: |
felix . winkelmann |
Subject: |
Re: [PATCH] export/rename |
Date: |
Wed, 04 Oct 2023 11:26:40 +0200 |
> Maybe this already works with the current patch, but can we support:
>
> (export (rename foo bar))
>
> As well as the version with the colon (suffix keyword notation) on the end of
> export?
> Seems like that would be best for symmetry with the import form.
>
> (Sorry, it’s just aesthetics, I know.)
Well, aesthetics is important. There are a couple of points, though:
- import "rename" has a different syntax, as it combines an import spec with
a rename list, here we effectively have a special case (3 argument list).
- exports go through ##sys#validate-exports, so originally "export",
"define-interface" and the export spec of the "module" form supported the
same export notation, but now we have a special case for export,
since we try to shoehorn renaming into the existing "export", but renaming is
not allowed in "module" and "define-interface". The "(rename OLD NEW)"
would be ambiguous with the old interpretation, of course.
- having "rename" + "rename:" adds another special case where both keyword
and normal symbol is allowed, I don't think we have this anywhere else.
- My original intention was to provide a low-impact renaming export in
the core in anticipation of re-using it for R7RS support. It still seems
useful for CHICKEN 5, but since rename-on-export appears to me a
seldom used feature I thought a separate form is sufficient.
felix