On 23-02-2023 09:51, Dr. Arne Babenhauserheide wrote:
Thinking a bit more about it, it should be possible to special-case
Guile's interpretation of "#!" such that "#!r6rs" doesn't require a
closing "!#".  (Technically backwards-incompatible, but I don't think
people are writing #!r6rs ...!# in the wild.)
Do you need the closing !# if you restrict yourself to the first line?

I thought so at first, but doing a little experiment, it appears you don't need to:

$ guile
scheme@(guile-user)> #!r6rs
(display "hi") (newline)

(output: hi)

Apparently Guile already has required behaviour.

Still doesn't really address the problem though, as Scheme scripts (or
scripts in another language) may need to start with a shebang and
"#!lang" or "#lang" is not a valid comment in all languages.  (E.g., I
don't think it's valid Pascal, though I only have read some Pascal
code, I haven't looked at the specification.)
I think itmust be ignored in all languages that work as scripts in
POSIX. So I would expect that support for ignoring #!... in the first
line is very widespread.

The problem is that not all languages were made with POSIX-style scripts in mind, e.g. Pascal, BASIC and Java (*).

Greetings,
Maxime.

(*) Java actually allows "#!", but only in 'Shebang' files (see: https://openjdk.org/jeps/330#Shebang_files). It remains invalid to put a '#!java' line in files with a class definition that is supposed to be found by Java's class loaders and compiler (in Guile terms, the source code of a module).

Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to