[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: On keywords, symbols, and reader options
From: |
Marius Vollmer |
Subject: |
Re: On keywords, symbols, and reader options |
Date: |
16 Jun 2001 22:14:23 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.102 |
Matthias Koeppe <address@hidden> writes:
> I find Guile's treatment of keywords confusing and counter-productive.
> In this article, I first discuss a few issues; then I propose a
> change.
Very short answer: for portability, I think you should avoid using
keywords altogether. Do not use (read-set! keywords 'prefix) for your
code when it runs in Guile.
> 1. Remove the notion of keywords; just make them symbols with a
> leading colon.
>
> 2. Introduce a module variable KEYWORD-STYLE, which can be one of #f
> and 'prefix. If set to prefix, all symbols starting with a colon
> are self-evaluating.
Hmm, this amounts to making keywords a subtype of symbols, right?
(define (keyword? obj)
(and (symbol? obj)
(> (string-length (symbol->string obj)) 0)
(char=? (string-ref (symbol->string obj) 0) #\:)))
Also, it would move the determination of whether something behaves
like a keyword from read time to execution time.
I like the current setup better, where keywords are constructed at
read-time and treated the same at execution time.
> 3. Add a DEFINE-MODULE keyword argument :KEYWORD-STYLE which sets the
> module variable.
What we probably should do is to make load-module save/restore the
reader options around loading the file.