[plt-scheme] syntax identifier used out of context

From: Jon Rafkind (rafkind at cs.utah.edu)
Date: Thu Dec 11 12:40:20 EST 2008

Noel Welsh wrote:
> bar2 is define'd, so it is bound in the evaluation environment, not
> the transformation environment.  So that explains the second error.
> If you want to use it in the transformer env you should
> define-for-syntax it.
Thats true, but define-for-syntax is disallowed inside another 
(define-syntax (foo stx)
  (define-for-syntax (bar) ...))
 > illegal use (not at top-level) in: (define-values-for-syntax (bar2)

> As for the first, I'm not sure.  But I think this code can't work as
> bar2 is defined as a fn stx -> stx but it is used in the eval env, so
> it won't receive stx of q but rather the actual value of q.
I'm not sure about that since bar is a fn stx -> stx as well, its just 
defined outside the foo function.
> Hope that is correct...
> N.
> On Thu, Dec 11, 2008 at 7:21 AM, Jon Rafkind <rafkind at cs.utah.edu> wrote:
>> I'm wondering why I get this error from the following code. ...

Posted on the users mailing list.