4 ms·
`#:name` style keywords are pretty common in Scheme implementations. I've grown to like the style; makes them stand out more visually. (Possibly uniquely, Chick
by shawn_w 2y ago
`#:name` style keywords are pretty common in Scheme implementations. I've grown to like the style; makes them stand out more visually. (Possibly uniquely, Chicken lets you choose between several different styles; :common-lisp, dssl: and #:sharp-colon)
Making square brackets an alternative to parens is another thing I like (also supported by some Schemes and in R6RS but not R7RS). You don't see it as often but you can also use curly braces as another alternative. Hmm. Maybe they should borrow from perl¹ and have any pair of matched characters count.
1: https://perldoc.perl.org/feature#The-%27extra_paired_delimiters%27-feature https://perldoc.perl.org/feature#The-%27extra_paired_delimit...
- neilv 2y agoI don't know for certain, but I think Racket (PLT Scheme) started both of these. (Scheme implementors do tend to have a strong-minded side, but also tend to be aware of other implementations, and some are willing to borrow smaller details from other implementations, or at least to show they can support that too.) IIRC, one of the arguments for `#:` in Racket was that one of the SRFIs incidentally kludged `:` keywords for its own purposes, and someone didn't want to break that SRFI. :)
- soegaard 2y agoI think the problem was that `foo:` is a legal symbol. That is, there were a potential backwards compatibility problem. That said, I wish we adopted the `foo:` style back then. Btw - since `foo:` is a legal identifier and references to unbound identifiers are rewritten to `(#%top . id)` one can write a custom `#%top` to any `id:` into `#:id` without making a new language. This technique is used in `scribble/html/main` for turning identifiers that end with colon into self-quoting symbols.
- neilv 2y agoI like both `:foo` and `foo:`, and could've gone with either one. IIRC, Joe Marshall pointed out at the time that `:foo` means the colons line up nicely when you have a long form of keyword arguments, each one starting its own line. And one of those lines might have multiple lines dangling off it, but the lined-up colons and indentation help make the structure clear visually. Typed Racket later made use of colons on the ends of identifiers, like in `let:` and `lambda:`, to mean like the Scheme form, but with expressed types. (I might've tried to use square brackets for sprinkling optional type annotations. Such that a trivial syntax transform could go from typed to untyped, simply by removing square bracket forms, or by substituting a square bracket form with its first element.) Having Scheme code easy to type, and easy on the eyes, are two of the things that are important to me, though not the most important. I wondered whether the `#:` was insisted upon because someone didn't see code the same way I do, and thought that the people who objected were only bikeshedding about minor details. But it's a minor detail that was shredding the eyeballs of some of us throughout each day. :)