Second round of proposals for directives Lassi Kortela (17 Feb 2021 08:34 UTC)
Re: Second round of proposals for directives Marc Nieper-Wißkirchen (17 Feb 2021 08:53 UTC)
Re: Second round of proposals for directives Lassi Kortela (17 Feb 2021 09:25 UTC)
Re: Second round of proposals for directives Lassi Kortela (17 Feb 2021 09:43 UTC)
Re: Second round of proposals for directives Marc Nieper-Wißkirchen (17 Feb 2021 09:51 UTC)
Re: Second round of proposals for directives Lassi Kortela (17 Feb 2021 10:11 UTC)
Re: Second round of proposals for directives Marc Nieper-Wißkirchen (17 Feb 2021 10:31 UTC)
Re: Second round of proposals for directives Marc Nieper-Wißkirchen (17 Feb 2021 09:44 UTC)
Re: Second round of proposals for directives Lassi Kortela (17 Feb 2021 10:01 UTC)
Re: Second round of proposals for directives Marc Nieper-Wißkirchen (17 Feb 2021 10:43 UTC)
Re: Second round of proposals for directives John Cowan (18 Feb 2021 02:56 UTC)
Re: Second round of proposals for directives Marc Nieper-Wißkirchen (18 Feb 2021 10:37 UTC)
Re: Second round of proposals for directives Vladimir Nikishkin (18 Feb 2021 15:42 UTC)
Re: Second round of proposals for directives Marc Nieper-Wißkirchen (18 Feb 2021 15:51 UTC)

Second round of proposals for directives Lassi Kortela 17 Feb 2021 08:34 UTC

Continuing from Marc's comments at the end of the previous thread:

> For the original purpose of SRFI 220 (line-oriented embedded data like license information or editor-specific settings), it is, therefore, adequate to re-use the line comment syntax of Scheme, namely ";".  SRFI 220 can define a magic character so that line comments beginning with such a character are understood to be machine-readable, e.g. ";* License: GPL-3.0".  This has the following big advantages:
>
> (1) It is compatible with all Schemes in existence.
> (2) The ";*" directives are naturally limited by line endings as most external tools would expect.
> (3) There is nothing like embedded comments, nested comments, or multi-line recursive data structures in ";" comment lines, making parsing for external tools much easier.
> (4) There won't be any interdependencies with the existing use of the "#!" characters, which prefix reader directives.

I continue to think that mixing ";" or "#;" comments with directives for
external tools is not a good idea.

However, after playing around with some examples, we could get a syntax
that seems reasonable by treating line directives as strings, as you and
Vladimir suggested.

How about this:

Line directive parsed like a ";" comment:

"#!" <horizontal whitespace+> <horizontal characters>

Datum directive:

"#!" <no whitespace here> <datum>

This would be simple, extensible, and would support even elaborate
extensions like this:

#!(foo
     (bar baz))

As for which directives can be ignored and which cannot, we could make
it so that:

- line directives can always be ignored (???)

- datum directives can never be ignored

- however, the datum directive #!(ignorable foo bar) says that it's
permissible to ignore #!foo and #!bar. The word `ignorable` is from
Common Lisp's (declare (ignorable foo bar)).

- we could also support #!(cond-expand (foo-scheme (datum-directive
...))). there would still be no read-time evaluation of Scheme code
(unless a particular directive does read-time evaluation) but we could
use the boolean expression expander from SRFI 0's cond-expand.