Re: Keyword arguments in procedures specified in SRFIs
Lassi Kortela 24 Jul 2019 13:42 UTC
> The #: prefix was chosen due to prior art (Common Lisp). It makes sense to preserve the compatibility for
>
> - programmers with prior experience with CL
> - prior documentation, manuals and books on CL
> - interoperability with CL (write a datum from CL and read it from Gambit, and vice-versa)
> - past ~10 years of use by Gambit users
Shiro and I also prefer CL-compatible syntax but my reading is that it's
more controversial in this discussion than using #: for keywords. That's
why I was trying to explore alternatives. Though if you side with CL'ish
syntax for keywords as well, the debate is split about even :)
> By the way, the eq-ness in a datum can be preserved with write-shared…
>
> > (let ((a (string->uninterned-symbol "foo"))
> (b (string->uninterned-symbol "foo")))
> (write-shared (list a b b))
> (newline))
> (#:foo #0=#:foo #0#)
Cool! I had no idea there are separate write and write-shared
procedures. write-shared is standardized in R7RS even. The approach of
re-using the generic shared-structure marker syntax makes sense.
Apparently Common Lisp uses the same approach when you bind
*print-readably* to true:
(let ((*print-readably* t)) (let ((g (gensym))) (write (cons g g))))
writes:
(#1=#:|G2814| . #1#)