On 23-02-2023 19:04, Maxime Devos wrote:
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 (*).
I forgot about the following:
Also since the language implementation is in Guile, this could simply be added for Guile. That may prevent using this file from other implementations of the language, but it should work well enough as a first step.
I disagree, because there is an alternative solution that should be straightforward and avoids the downside of making an extension to the language that could confuse other implementations.
Quoting myself:
The '#lang whatever' stuff makes Scheme (*) files unportable between implementations, as '#lang scheme' is not a valid comment -- there exist Schemes beyond Guile and Racket. If it were changed to recognising '-*- mode: scheme -*-' or '-*- language: scheme -*-' or such, it would be better IMO, [...]
E.g.: ;; -*- insert-bikeshed-here: scheme -*- // -*- insert-bikeshed-here: c++ -*- # -*- insert-bikeshed-here: ecmascript -*- /* -*- insert-bikeshed-here: c -*- */ {*** *- insert-bikeshed-here: pascal -*- ***} REM -*- insert-bikeshed-here: basic -*-I suppose the decision could be made to add support for "#lang" for compatibility with Racket when 'lang' is some language Racket supports, despite the fact that "#lang" is invalid in some of those languages, but IMO we should avoid adding new extensions that confuse ‘native’ implementations when something compatible like "-*- ... -*-" can be done instead.
Greetings, Maxime.
OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature