[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MIT-Scheme-devel] Keywords
From: |
Chris Hanson |
Subject: |
Re: [MIT-Scheme-devel] Keywords |
Date: |
Mon, 15 Mar 2010 15:14:51 -0700 |
This should be a per-file option; it's a syntactic hack. Instead of
having a global option, invent some kind of # syntax to say what the
keyword syntax is. This is how case sensitivity should be handled as
well, IMO.
On Mon, Mar 15, 2010 at 3:00 PM, Joe Marshall <address@hidden> wrote:
> I've added `keyword' objects to MIT Scheme in a way that I hope
> keeps everyone happy. A keyword is a self-evaluating symbolic
> token, much like a symbol, but it never needs quoting because it
> can never mean anything but itself.
>
> The reading and printing of keywords is controlled by the variable
> *keyword-style*, which can be #f or one of these symbols:
> cl, dsssl, srfi-88, both
>
> If *keyword-style* is #F (the default), then there is no way to
> read keywords, and they are printed as #[keyword foo].
>
> If *keyword-style* is 'cl, then tokens with a leading colon are
> considered keywords and keywords are printed with a leading colon.
> Symbols with a leading colon are printed with vertical-bar quotes
> and you can create symbols with leading colons by using vertical-bar
> quotes.
>
> If *keyword-style* is 'srfi-88, then tokens with a trailing colon are
> considered keywords and keywords are printed with a trailing colon.
> Symbols with a trailing colon are printed with vertical-bar quotes
> and you can create symbols with trailing colons by using vertical-bar
> quotes.
>
> 'dsssl is a synonym for 'srfi-88
>
> If *keyword-style* is 'both, then either syntax is acceptable for reading,
> but the cl syntax will be used in printing. (Putting a colon on both ends
> would be weird, so don't.)
>
> The way quoting is currently implemented on symbols makes it hard
> to determine if the quotation occurs before or after the first character
> or the final character, so non-standard keywords like :|a weird keyword|
> end up being interpreted as symbols.
>
> rationale:
> I find these things to be very pragmatic for use in large, complex systems.
> I prefer the Common Lisp style with the leading colon because it is easier
> to see the keywords. The trailing colon syntax is cute, but the nifty
> examples
> that are shown, like this:
>
> (tcltk-frame relief: 'ridge
> borderwidth: 4
> height: "50px"
> width: "100px")
>
> just don't look anywhere near as good when the *values* are keywords, which
> they often are.
>
> (call-with-mumble
> option: default: name: none:)
>
> The PLT syntax of #:key is just plain stupid.
>
> --
> ~jrm
>
>
> _______________________________________________
> MIT-Scheme-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/mit-scheme-devel
>