Hello. I am new to Scheme/Racket (not to programming) and am trying to learn Racket through BeautifulRacket. After a few chapters I got interested in learning more about Racket's macro capabilities (before going back to the BR chapters) and ran off to read Greg Hendershott's "Fear of Macros". In it, in chapter 4 (4 Pattern matching: syntax-case and syntax-rules), he has this code (the idea is to provide a capability to "index" into a hash table using dot notation, I guess - such as (hash.refs js.a.b.c) should return "value"):
In (with-syntax ([keys (cdr ids)[) ...) the pattern keys is bound to a syntax object representing a list (the result of (cdr ids)).
Within the template that begins with #' the pattern variable keys will be replaced by the syntax object to which it is bound - that is, it will be replaced the the identifiers from (cdr ids).
I think, IOW, that keys contains the equivalent of #'(a b c) (assuming the invocation was something like (hash.refs table a b c)). When putting this list in, without a quote, it would expand to (hash-refs table (a b c) #f). This is unlikely to be correct; what we really want is (hash.refs table '(a b c) #f).
With syntax-parse this kind of example is a bit clearer, but Fear of Macros does a nice job connecting the dots between low-level macro primitives and higher-level DSLs like syntax-case/syntax-parse.
I guess what has/had me confused is that in the same code, one line above "hash-table" is the first element of "ids" and I guess that's a syntax object as well, yet it is not quoted in the #'(hash-refs hash-table 'keys default) line. I got a bit confused, new to this. Thanks