Re: Here strings, and #[...] (one more implementation that does both)
Lassi Kortela 21 Nov 2022 15:12 UTC
Hi, and thanks for commenting!
> "Chicken and Gambit support multi-line strings via the following
> syntax."
>
> STklos does the same. And it uses #[...], as MIT Scheme does, for
> unreadable objects:
>
> stklos> (current-input-port)
> #[input-virtual-port 7f641397b790]
> stklos> display
> #[primitive display]
> stklos> (define-syntax b (syntax-rules () ((_) 'whatever)))
> stklos> b
> #[syntax b]
> stklos> (find-module 'stklos)
> #[module stklos]
> stklos> (delay 1)
> #[promise 7f77da492dc0]
> stklos> (define-external c-fabs ((fd :double)) :entry-name "fabs" :return-type :double)
> stklos> c-fabs
> #[external-func fabs]
Good to know. I wonder if there are more that use #[...], and where each
convention comes from. I can find neither #[...] nor #<...> in Emacs
Lisp, nor in the "pitmanual" (Kent Pitman's MacLisp manual, free to read
on the web).
Just noticed that MIT Scheme has:
#<abc>
;Value: #[uri 12 "abc"]
That has to come from the syntax <http://example.com/> recommended in
some of the web RFCs for embedding URIs in prose.
> Interestingly, in STklos, EOF and void are not unreadable. Type #eof at
> the REPL and it goes away. :) Bigloo does the same with EOF, but the
> name is #eof-object.
Chez and Chicken too. Both use #!eof.
The trouble is you can't disambiguate #!eof and end-of-file. You can
e.g. write #!eof in the middle of a source file to confuse the reader.
> Or, if you type (define x #void) in STklos you'll get the
> same result as (define x (if #f #t)).
Yes. https://docs.scheme.org/surveys/void-value/