[plt-scheme] syntax/loc vs #'

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Mar 30 23:15:28 EST 2004

At Wed, 24 Mar 2004 15:16:24 -0500, Doug Orleans wrote:
> Is there really ever a reason to use syntax instead of syntax/loc?

`syntax' is certainly good enough if you're not constructing a new
syntax object, as in #'x. It's also fine when constructing a temporary
object, as in `(syntax->list #'(id ...))'.

When constructing a syntax object that's supposed to be right by
construction, then using #' seems fine to me. (If the result is bad, I
generally want the location in the erroneous macro.) Your recent
experience may well suggest otherwise, though.

> Why doesn't syntax/loc have an abbreviation instead? Is it simply
> because it takes two arguments?

Mainly it's that the #' abbreviation is a natural fit for `syntax' in
parallel to `quote'. There's no obvious candidate for `syntax/loc' (at
least not one that's obvious to me), and there wasn't any demand


Posted on the users mailing list.