Re: Second round of proposals for directives
Lassi Kortela 17 Feb 2021 09:25 UTC
> I continue to think that mixing ";" or "#;" comments with directives
> for external tools is not a good idea.
>
> Could you elaborate on why this is not a good idea? There are
> directives, which affect the Scheme reader, and there is
> meta-information that affects external tools instead, but not Scheme
> semantics. For the latter, comments seem to be made for. (This is not
> without precedents. For example, Chibi uses ";;>" for chibi-doc.)
The existing culture is to use magic comments for external tools because
we don't have anything better (in Scheme, or in other languages).
Conceptually,
;; Encoding: UTF-8
and
#!(encoding utf-8)
are not different.
I think there's no fundamental dividing line between directives that
belong to Scheme and directives that belong to external tools. It can be
useful to have the full range of S-expression structure for both, and
if we unify both under the same concept, we can use the same hooks for
processing them.
It's true that there is a dividing line about what affects RnRS Scheme
and what doesn't, but that's about it. Lots of things can affect a
Scheme implementation without touching on RnRS semantics.
The #!(ignorable ...) and #!(cond-expand ...) suggestion [note,
ignorable can be nested inside cond-expand to ignore different
directives in different situations] would take care of the difference
between directives needed for Scheme semantics and those not needed.
> This is not good. Everywhere else in the lexical syntax of Scheme, a
> valid representation of a datum (properly delimited) can always be
> replaced by the same representation but enclosed in extra whitespace.
> Don't remove this invariant to keep the language consistent.
The existing RnRS syntax requires that #!<identifier> has no whitespace
in between.
As surveyed in the SRFI's rationale, many Lisp readers already have #!
processing (and not only in the first line of the file) so there would
be potential to try and standardize something lisp-wide.
#! is also two prominent-looking characters, a good sign that there's
something unusual going on here.
> As for which directives can be ignored and which cannot, we could make
> it so that:
>
> - line directives can always be ignored (???)
>
> Then they are comments from the point of view of Scheme. That can be a
> feature but then we can and should use the comment syntax. (See above.)
Comments are the designated way to write ignored stuff in a source file,
as evidenced by the fact that there's no way to comment out a comment in
order to ignore it. You can comment out any other part of the syntax to
ignore it, but not comments.