At Thu, 29 Jun 2017 08:10:25 -0700 (PDT), Sam Waxman wrote:
> One of my constructs, (func name(args) body), defines a function that's able 
> to be called afterwards, and it desugars into a pretty regular define 
> statement. [...]
> 
> While I don't want this to be allowed, I'd like to catch this and
> throw my own errors if this happens. The only way I can really
> imagine doing this is to modify all the functions I have that take in
> expressions (+ - * / let ...) and give them contracts that say "Hey,
> check to make sure your arguments are expressions, and if not, throw
> this syntax error!"

The only way to check whether a form is an expression or definition is
to partially expand it and match on the form.

In this case, maybe you want to report the error from the
implementation `func` by using `syntax-local-context` to detect when
it's being used in an expression position.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to