[r6rs-discuss] [Formal] syntactic sugar causes cancer of the exports

From: AndrevanTonder <andre>
Date: Fri, 15 Jun 2007 17:26:08 -0400 (EDT)

On Thu, 14 Jun 2007, William D Clinger wrote:

> (rnrs syntax-case (6)) apparently does not export
> ... _ set!

I was just about to resubmit a comment on this. Hopefully it will be
corrected. Also, it should probably be stated that UNSYNTAX is bound and
exported to prevent confusion.

> It is easy for implementors of a library
> to overlook the need for these exports.

In my experience, having written some libraries in a working system,
such oversights show up very quickly in testing with good error
reporting. Indeed, my previous comments regarding the need for some
of these exports at specific levels were prompted by such testing.

> Worse, it is easy for a client of a library to overlook
> these exports.

> Worse still, clients may not be able to determine the
> exported identifiers by examining the source code of
> the libraries they import.

At least some of the harm that may be caused by this is limited
by the syntactic constraint that prevents users from redefining
imported identifiers. But there is an even more tricky issue,
namely that even if you have access to the source of all imported
libraries, you cannot determine the /levels/ of the imported
identifiers without looking at the source of the entire chain of
indirectly imported libraries.

However, in practice, the /compiled/ form of a library should contain
all this information about exports and levels and can very easily
be inspected. In fact, given a toold to inspect it, it is /better/
to have the compiled form of a library than the source, since the latter
will typically have annotated all exported identifiers with their export
levels, and so has more information than the source version.

> (Recall that the endianness, file-options, eol-style,
> and error-handling-mode syntaxes are explicitly
> allowed to recognize implementation-dependent identifiers,
> which will presumably be exported by those libraries.)

> Clients' inability to determine which identifiers are
> exported by standard libraries implies that, in theory,
> it is impossible to write fully portable code that
> imports those libraries.

If I understand enumerations correctly, though, the members
of these universes are quoted symbols, right? So these do not
need to be exported. If this is correct, these standard libraries
will not have any nonstandard exports.

> The problem these four syntaxes cause is more severe
> than the problem they solve. They should be removed
> from the report, and Scheme programmers in general
> should remember that syntactic sugar causes cancer
> of the exports.

While, as explained above, I do not agree that the mentioned
problem necessarily exists, I think it would actually be nice
if these syntaxes were dropped, expecially since doing so
would allow the enumerations library to be dropped (which
I have never felt comfortable with).

Andre
Received on Fri Jun 15 2007 - 17:26:08 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC