Re: Text substitution macros and multi-file archives
Lassi Kortela 28 Jun 2021 08:07 UTC
> Free-text substitution macros tend to confuse humans and text editors
> alike.
>
> My `include-chunk' is just like an `include' macro as specified by the
> R7RS with the sole difference that it does not reference an external
> file but an embedded file.
>
> Your claim (which is not true in the generality you claim) therefore
> does not apply.
>
> It would be a good principle for each Scheme implementation to
> have an alternative way to use the features that are invoked via
> non-standard read syntax.
>
> In general, this is not possible. And when it is possible, it may only
> be possible through an ugly hack.
> If you want `scheme-script-ce' future-proof, general and flexible, the
> file format just needs to allow more than just a list of s-expressions.
> (In fact, already the shebang line is such an extension.) S-expressions
> are good but they are not the right tool for everything.
This may be a case of Unix vs Lisp preference in design aesthetic (I'm
strongly in the Lisp camp), but to me, nesting different read syntaxes
in the same file, and free-text handling of structural data, imply there
has to be a better way. Archive files are fine, but should be a separate
file type that is generated by bundling from other files, not something
that is edited as-is.
If the problem gets complex enough that one needs to use different read
syntax per implementation, IMHO it starts to outgrow the simplicity of a
script. If a "Scheme archive" file format is desired, I think it should
be a separate one. The simplest idea would be running Scheme code from a
tar file (e.g. find "main.scm" in in the archive, and run that). This is
similar to Java .jar files, which are a huge success, and those are just
zip files under the hood. If a Scheme implementation supports putting a
tar or zip file in its library search path, and looking for libraries in
the archive, not much extra is needed to run a "main.scm".