On Saturday, 25 June 2016 08:13:04 UTC+10, Matthew Flatt  wrote:
> If you write 
> 
>  (struct point (x y))
> 
> then `point` is bound as syntax that both expands to the `point`
> constructor and provides static information about the point` structure
> (as used, for example, by `match`).
> 
> You could avoid the indirection through syntax, sacrificing static
> information, by adding `#:omit-define-syntaxes`:
> 
>  (struct point (x y) #:omit-define-syntaxes)
> 
> 
> For what it's worth, I recommend avoiding `namespace-variable-value`.
> There's usually a better way, but it depends on what you're trying to
> do.
> 
> At Fri, 24 Jun 2016 14:49:03 -0700 (PDT), "Matt A. Peerson" wrote:
> > Hi,
> > 
> > When I define a struct (named e.g. "point") and use 
> > namespace-variable-value 
> > in REPL it gives the error: namespace-variable-value: bound to syntax in: 
> > point
> > 
> > Is this normal? (although even if it is, it'll force me to use class 
> > definitions for my structs in my current project).
> > 
> > Thanks!

The reason for using namespace-variable-value:
I'm using the namespace-mapped-symbols to get the symbols, then 
namespace-variable-value to get the value of some of those symbols. Struct 
definitions come with the set of namespace-mapped-symbols. The only alternative 
I could find is using #%top to use a symbol from the set of 
namespace-mapped-symbols (but I have to learn what it is and if it'll work for 
my case).

-- 
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to