Yep. ^_^ I like to use the pattern `(... (',(fn () x)) ...) to refer to all kinds of values from within generated code. I think it was http://arclanguage.org/item?id=11612 that prodded me into doing this.
Usually ',x is enough, but (',(fn () x)) has the benefit that it preserves the identity of something that has mutable state. Racket copies many data structures if they appear as syntax, even inside 'quote forms, but lambdas are data structures that escape that wrath.
arc> (is is (eval `',is))
arc> (mac thunk body `(fn () ,@body))
#(tagged mac #<procedure: thunk>)
arc> (is thunk (eval `',thunk))
arc> (is thunk (eval `(',thunk.thunk)))
arc> (= foo '(1 2 3))
(1 2 3)
arc> (is foo (eval `',foo))
arc> (is foo (eval `(',thunk.foo)))
I think the copying happens at the moment the Racket (quote ...) form is compiled:
Welcome to Racket v5.0.1.
> (define vec (vector 'a 'b 'c))
> (vector-set! vec 1 'r)
'#(a r c)
> (eval `(define (get-vec) ',vec))
> (vector-set! (get-vec) 2 't)
vector-set!: expects type <mutable vector> as 1st argument, given: '#(a r c); other arguments were: 2 't
=== context ===
> (eq? (get-vec) (get-vec))
> (eq? (get-vec) (eval `',(get-vec)))
> (eq? (get-vec) (eval `(',get-vec)))
If you want to work around this in your version of Arc, you can probably just have 'ac generate ((quote <procedure-returning-x>)) wherever it would normally generate (quote <x>). ^_^
Depending on the rest of your code, quasiquotation may need changes too. Maybe `(1 ,x 3) should compile to ((quote #<cons>) 1 ((quote #<cons>) value-of-x ((quote <procedure-returning-(3)>))))? If you're using fallintothis's code, this is probably relatively easy to accomplish.
If you don't work around Racket's copying, that's fine too. :-p
You can quote anything, literally anything. Why wouldn't you be able to? The only caveat, if you can call it that, is that you can't necessarily 'write out the resulting code sexpr readably (for example, functions are not, as a rule, writable).
The only reason why you need to quote certain things at all is because the arc compiler is very picky about its input -- it cases on the type of the sexpr it's compiling, and if it doesn't recognize the type it throws an error -- but things inside a quotation escape this examination. If this weren't the case, and it instead just passed them through, then functions could be embedded directly instead of quoted; and everything (I think) other than symbols and lists evaluate to themselves in mzscheme.