[racket-dev] problem with require and frtime

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Jan 20 09:05:30 EST 2012

At Fri, 20 Jan 2012 13:45:35 +0100, Marijn wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 19-01-12 14:13, Matthew Flatt wrote:
> > The `frtime' language exports an `=' that isn't the same as `=' in 
> > `racket', so that's why the pattern doesn't match. (This seems like
> > a further weakness of the `frtime' docs to specify the exports 
> > precisely.)
> > 
> > You could avoid bound names like `=' as literals in the macro. 
> > Normally, it works best for a form-exporting macro to also export 
> > bindings for any literals in the form. Otherwise, this kind of 
> > confusion is common.
> 
> I think I will change the `=' to `!' for now. What kind of binding
> should I use for `?' and `!'? There is no sensible meaning to be bound
> to them...
> What do you use to bind `else'?

The `else' from `racket/base' is bound to a macro that always complains
that `else' isn't an expression. For the implementation, see
"collects/racket/private/cond.rkt".


> When cond starts using #:else I might consider this more seriously.

For what it's worth, if I were tweaking the language unencumbered by
existing code, I really would change `else' to `#:else'.


> The reference claims that "A keyword is like an
> interned symbol, but ... and a keyword cannot be used as an
> identifier" implying that symbols can be used as identifiers.

I agree that it doesn't imply the right use of the word "symbol" and
"identifier". I'll change it, perhaps to "a keyword cannot be used to
form an identifier in the same way as a symbol".


> I have in my head from unknown source (maybe from other schemes) that
> a keyword is a value which evaluates to itself, like a constant,
> whereas symbols are produced by quoting identifiers.

In those other contexts I would say "a keyword can be used as an
expression that evaluates to itself" or "a keyword is self-quoting".

In Racket, however, a keyword is not an expression. The distinction
between a keyword and an expression exactly why I prefer a keyword when
a syntactic marker is needed. It's especially better in a case like
`else', where either the marker or an expression can appear in the same
place. (In your macro, expressions cannot appear in the same place as
`?' and `!', so the difference is less significant.)

See also

 "Keyword and Optional Arguments in PLT Scheme"
 Flatt and Barzilay, Scheme'09
 http://www.cs.utah.edu/plt/publications/scheme09-fb.pdf



Posted on the dev mailing list.