guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] add language/wisp to Guile?


From: Maxime Devos
Subject: Re: [PATCH] add language/wisp to Guile?
Date: Thu, 23 Feb 2023 08:59:16 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.0

In Racket, in the initial configuration of the reader when reading a file, "`#!` is an alias 
for `#lang` followed by a space when `#!` is followed by alphanumeric ASCII, `+`, `-`, or 
`_`." (See 
<https://docs.racket-lang.org/reference/reader.html#%28part._parse-reader%29>.) [...] > 
(Guile does not handle `#!r6rs` properly, presumably because of the legacy `#!`/`!#` block 
comments. I think this should be a surmountable obstacle, though, especially since Guile does 
support standard `#|`/`|#` block comments.)

‘#! ... !#’ comments aren't legacy; they exist to allow putting the shebang in the first 
line of a script, and to pass additional arguments to the Guile interpreter (see: 
(guile)The Top of a Script File) (*).  As such, you can't just replace them with #| ... 
|# (unless you patch the kernel to recognise "#| ..." as a shebang line). [...]

Furthermore, according to the kernel, #!r6rs would mean that the script needs 
to be interpreted by a program named 'r6rs', but 'guile' is named 'guile', not 
'r6rs'.  (I assume this is in POSIX somewhere, though I couldn't find it.)

(This is an incompatibility between R6RS and any system that has shebangs.)

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.)

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.)

Greetings,
Maxime.

Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]