From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Philip McGrath" <philip@philipmcgrath.com> Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] add language/wisp to Guile? Date: Fri, 17 Feb 2023 22:50:37 -0500 Message-ID: <08c725bd-84d4-4df9-a18c-6ee55d00634f@app.fastmail.com> References: <87h6w2fkz8.fsf@web.de> <f31a073e-6b8c-ce48-2917-53a13d76b108@telenet.be> <877cwxe4ar.fsf@web.de> <2f7d015d-ceb4-ef8f-b4fe-b69e39b723f8@telenet.be> <87357ldqaq.fsf@web.de> <1a70460e-11fb-9f5d-0d5f-1eb507d5af0d@telenet.be> <87ilg4j65e.fsf@web.de> <87edqsj5vt.fsf@web.de> <01212259-37dd-5d67-7bbc-101e01d96d01@telenet.be> <1a6c8dda-0124-124c-f932-937a11386ced@gmail.com> <87fsb5i912.fsf@web.de> <ece631e3-8b04-d538-1d8d-fd09fc8562cb@telenet.be> Mime-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19036"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.9.0-alpha0-156-g081acc5ed5-fm-20230206.001-g081acc5e To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Sat Feb 18 15:30:00 2023 Return-path: <guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org> Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org>) id 1pTODv-0004jB-Tr for guile-devel@m.gmane-mx.org; Sat, 18 Feb 2023 15:30:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guile-devel-bounces@gnu.org>) id 1pTODe-0001Ux-60; Sat, 18 Feb 2023 09:29:42 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <philip@philipmcgrath.com>) id 1pTEG8-0002Et-SM for guile-devel@gnu.org; Fri, 17 Feb 2023 22:51:36 -0500 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <philip@philipmcgrath.com>) id 1pTEG6-0000sv-Fi for guile-devel@gnu.org; Fri, 17 Feb 2023 22:51:36 -0500 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 31CBB5C0136 for <guile-devel@gnu.org>; Fri, 17 Feb 2023 22:51:30 -0500 (EST) Original-Received: from imap52 ([10.202.2.102]) by compute1.internal (MEProxy); Fri, 17 Feb 2023 22:51:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= philipmcgrath.com; h=cc:content-transfer-encoding:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to; s=fm1; t=1676692290; x=1676778690; bh=X3NU8Uo3LZGik9rxKeF8N3Tmz huIQUdxmRDDwaEzhPA=; b=r8b60sFR9bZkDOJIMBZXUfr6G6Ao/p+uihgVZG7Jj gvaTzANiFM9vLmyyqLokmF0x3qqgO6Zbm7f5XfLoi3Xpxs16azVIr19/q8/fa8ee 0TiGiHvrtaVoDqsKaXrE+kTGIGzbFpFG1jEEMI8zZ1bO8r2o4RgPqQnSMQ0ZWMsT ttwiEiWsE7I7smVzcPOnUAFWfKOx6xaJVMsoF+I4t3YE1NOfaQBIyv10BHwCm0EV 3sd8xzI0aURcGXKCnohYdI4JtaVokd6sT+jP2uE9Y5i56lcX6HkHvD1ghHBZ3jpx A7kws9MNeX46FOeoN3DDXyb6c/8CmTBYDNQCfre/1fzpA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1676692290; x=1676778690; bh=X 3NU8Uo3LZGik9rxKeF8N3TmzhuIQUdxmRDDwaEzhPA=; b=KSuk9z4dY9Lws8Ye5 yyEsY/mzcqeekh9GdkuCtQSCSeMXos+Y88Pj1DIVanUlYmaxh/0OVDP8xqp3rW8q lm5/4csXzS/89SxeqoIBh1tg4TlNvRc2ekRvH03mfMvykHAbbJfBrFKPdSHLKBPN TMjIwXxkfxxEH4WeHpcDgrOKtpepOwgxQFxIoGobQpDFKEJQ4+DZ1hbdempxrvaV 2BNrOGzRhPJCEfysLSFO3x/fX86oCh0Pm1168i+GTFAPH4A3QmbbYT+v9clmcfo+ CJZuL+5gFzBx0WxyPdwo5joEt77kkzsol0YKEbxwe9x3wvrQbezawFBelRO+Yj/t F0xrQ== X-ME-Sender: <xms:QUvwY3laU5NaM4zmX9sP3MphLg7xg4V6D0DamwKUfcfCIWjPakrBZg> <xme:QUvwY61XSDscXPYXUBMRPvuNKP4WdzFhi-sy4_K8uy7Z__5Q4Sj9Ya8WxmT0ql5l8 uj-6OiCFQM0Hmi5eas> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudejtddgiedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgoufhushhpvggtthffohhmrghinhculdegledmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfrfhh ihhlihhpucfotgfirhgrthhhfdcuoehphhhilhhiphesphhhihhlihhpmhgtghhrrghthh drtghomheqnecuggftrfgrthhtvghrnhepuefgudduieekieeifffhgffhgfegvedvfedu tddtveehtdetkefhkeeuueduhfefnecuffhomhgrihhnpehgihhthhhusgdrtghomhdprh eirhhsrdhorhhgpdhgihhthhhusgdrihhopdhrrggtkhgvthdqlhgrnhhgrdhorhhgpdgs rhhofihnrdgvughupdifihhnghholhhoghdrohhrghenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehphhhilhhiphesphhhihhlihhpmhgtghhr rghthhdrtghomh X-ME-Proxy: <xmx:QkvwY9oabw29m6KfkJV4QN1tSNqb22w8xecQz3h6Of4J7ztxrGMNSw> <xmx:QkvwY_m2SZzucmZ1lE4kgOTCyEgPWr-UH1Z1oc9JQXtniJij6iNZFQ> <xmx:QkvwY11ilp2Z9vSSEP4FherNyZyTa9l-d870veAlpIuertz-V51jDA> <xmx:QkvwYzB-tm5ubCngSdxMZsl0Bw0GCO6w3Y10fH7UyzlZVmpdMRhbkQ> Feedback-ID: i2b1146f3:Fastmail Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id E6545C60091; Fri, 17 Feb 2023 22:51:29 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: <ece631e3-8b04-d538-1d8d-fd09fc8562cb@telenet.be> Received-SPF: pass client-ip=66.111.4.29; envelope-from=philip@philipmcgrath.com; helo=out5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 18 Feb 2023 09:29:39 -0500 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" <guile-devel.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guile-devel>, <mailto:guile-devel-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guile-devel> List-Post: <mailto:guile-devel@gnu.org> List-Help: <mailto:guile-devel-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guile-devel>, <mailto:guile-devel-request@gnu.org?subject=subscribe> Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:21714 Archived-At: <http://permalink.gmane.org/gmane.lisp.guile.devel/21714> Hi, On Fri, Feb 17, 2023, at 6:06 PM, Maxime Devos wrote: > On 16-02-2023 22:38, Dr. Arne Babenhauserheide wrote: >>=20 >> Matt Wette <matt.wette@gmail.com> writes: >>=20 >>> You may be interested in the load-lang patch I generated a few years= ago >>> to allow file-extension based loading, in addition to '#lang elisp" >>> type hooks. >>> >>> https://github.com/mwette/guile-contrib/blob/main/patch/3.0.8/load-l= ang.patch >>=20 >> @Maxime: Is this something you=E2=80=99d be interested in championing? > > For the '#lang whatever stuff', no: > > The '#lang whatever' stuff makes Scheme (*) files unportable between=20 > implementations, as '#lang scheme' is not a valid comment -- there exi= st=20 > Schemes beyond Guile and Racket. If it were changed to recognising > '-*- mode: scheme -*-' or '-*- language: scheme -*-' or such, it would=20 > be better IMO, but insufficient, because (^). > I haven't read the patch or this thread closely, but R6RS has an answer = to any concerns about compatibility with `#lang`. At the beginning of Ch= apter 4, "Lexical and Datum Syntax" (<http://www.r6rs.org/final/html/r6r= s/r6rs-Z-H-7.html#node_chap_4>) the report specifies: > An implementation must not extend the lexical or datum syntax in any = way, with one exception: it need not treat the syntax `#!<identifier>`, = for any <identifier> (see section 4.2.4) that is not `r6rs`, as a syntax= violation, and it may use specific `#!`-prefixed identifiers as flags i= ndicating that subsequent input contains extensions to the standard lexi= cal or datum syntax. The syntax `#!r6rs` may be used to signify that the= input afterward is written with the lexical syntax and datum syntax des= cribed by this report. `#!r6rs` is otherwise treated as a comment; see s= ection 4.2.3. Chez Scheme uses such comments to support extensions to lexical syntax, = as documented in <https://cisco.github.io/ChezScheme/csug9.5/intro.html#= ./intro:h1>: > The Chez Scheme lexical extensions described above are disabled in an = input stream after an `#!r6rs` comment directive has been seen, unless a= `#!chezscheme` comment directive has been seen since. Each library load= ed implicitly via import and each RNRS top-level program loaded via the = `--program` command-line option, the `scheme-script` command, or the `lo= ad-program` procedure is treated as if it begins implicitly with an `#!r= 6rs` comment directive. > The case of symbol and character names is normally significant, as req= uired by the Revised6 Report. Names are folded, as if by string-foldcase= , following a `#!fold-case` comment directive in the same input stream u= nless a `#!no-fold-case` has been seen since. Names are also folded if n= either directive has been seen and the parameter `case-sensitive` has be= en set to `#f`.=20 In Racket, in the initial configuration of the reader when reading a fil= e, "`#!` is an alias for `#lang` followed by a space when `#!` is follow= ed by alphanumeric ASCII, `+`, `-`, or `_`." (See <https://docs.racket-l= ang.org/reference/reader.html#%28part._parse-reader%29>.) This does not = conflict with Racket's support for script shebangs: "A `#!` (which is `= #!` followed by a space) or `#!/` starts a line comment that can be cont= inued to the next line by ending a line with `\`. This form of comment n= ormally appears at the beginning of a Unix script file." (See <https://d= ocs.racket-lang.org/reference/reader.html#%28part._parse-comment%29>.) F= urthermore, the lexical syntax for the rest of the file is entirely unde= r control of the specified language. Most languages parameterize the rea= der to reject further uses of `#lang` or its `#!` alias. Some "meta-lang= uages" chain-load another language but parameterize it in some way (e.g.= <https://docs.racket-lang.org/exact-decimal-lang/>). The `#!r6rs` langu= age, of course, handles `#!` exactly as specified by R6RS, with no exten= sions.=20 (Guile does not handle `#!r6rs` properly, presumably because of the lega= cy `#!`/`!#` block comments. I think this should be a surmountable obsta= cle, though, especially since Guile does support standard `#|`/`|#` bloc= k comments.) > > (^) it doesn't integrate with the module system -- more concretely,=20 > (use-modules (foo)) wouldn't try loading foo.js -- adding '-x' argumen= ts=20 > would solve that, but we agree that that would be unreasonable in many=20 > situations. (Alternatively one could place ECMAScript code in a file=20 > with extension '.scm' with a '#lang' / '-*- mode: ecmascript -*-', but=20 > ... no.) > Racket has a mechanism to enable additional source file extensions witho= ut needing explicit command-line arguments by defining `module-suffixes`= or `doc-modules-suffixes` in a metadata module that is consulted when t= he collection is "set up": https://docs.racket-lang.org/raco/setup-info.= html However, this mechanism is not widely used. Overall, the experience of the Racket community strongly suggests that a= file should say what language it is written in. Furthermore, that langu= age is a property of the code, not of its runtime environment, so enviro= nment variables, command-line options, and similar extralinguistic mecha= nism are a particularly poor fit for controlling it. File extensions are= not the worst possible mechanisms, but they have similar problems: code= written in an unsaved editor or a blog post may not have a file extensi= on. (For more on this theme, see the corresponding point of the Racket M= anifesto: <https://cs.brown.edu/~sk/Publications/Papers/Published/fffkbm= t-racket-manifesto/paper.pdf>) Actually writing the language into the so= urce code has proven to work well. To end with an argument from authority, this is from Andy Wingo's "lesso= ns learned from guile, the ancient & spry" (<https://wingolog.org/archiv= es/2020/02/07/lessons-learned-from-guile-the-ancient-spry>): > On the change side, we need parallel installability for entire languag= es. Racket did a great job facilitating this with #lang and we should ju= st adopt that. -Philip