It is simpler than a reader parameter:

#lang racket/base

(define read-colon-keyword
  (case-lambda
    [(ch port)
     (string->keyword (symbol->string (read/recursive port)))]
    [(ch port src line col pos)
     (datum->syntax #f (read-colon-keyword ch port)
                    (list src line col pos))]))

(define (make-colon-keyword-readtable)
  (make-readtable (current-readtable)
                  #\:
                  'non-terminating-macro
                  read-colon-keyword))

(module+ test
  (require rackunit)
  (define (reads in out)
    (check-equal? (read (open-input-string in)) out))
  (parameterize ([current-readtable (make-colon-keyword-readtable)])
    (reads "a:b" 'a:b)
    (reads ":a" '#:a)
    (reads "#:a" '#:a)))

On Wed, Oct 14, 2015 at 7:40 AM, Robby Findler
<[email protected]> wrote:
> It would not be too hard, I believe, to add a parameter to the reader
> so that symbols starting with colons read the same as keywords, and
> then to build a language like s-exp and at-exp that would let you use
> that notation in a fairly seamless and interop-friendly way. Even
> getting syntax coloring shouldn't be too hard.
>
>
> Robby
>
>
> On Wed, Oct 14, 2015 at 12:12 AM, Neil Van Dyke <[email protected]> wrote:
>> I think that Racket 6.3 would be a great time to make `:abc` read the same
>> as `#:abc`.
>>
>> For those of us who are pained deeply by `#:abc`, being able to use `:abc`
>> would be a big aesthetic improvement for Racket.
>>
>> Neil V.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-dev/561DE446.4070905%40neilvandyke.org.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-dev/CAL3TdONVr2%3DVr86PE6Tbjj_hQP%3DCpcdkdoKbLyP%3DLgpfVjjvmw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

           "Wherefore, be not weary in well-doing,
      for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
                          - D&C 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CAJYbDanh%3DQ%2BEqYeXA%2Be%2BabSndPYTMupCSLr09WV6u5w1aWkkDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to