[racket] graph-structured syntax
I've never been fully acquainted with the graph reader, so I did a little REPL-experimenting and doc-hunting. It appears Racket is pretty conservative about where it allows you to use graph syntax:
> (define x '#0=(foo . #0#))
read: #..-expressions not allowed in read-syntax mode
I imagine this is because cyclic AST's are Really Really Scary:
#0=(sin #0#))
But I can't quite figure out where, if anywhere, graph-structured S-expressions *are* allowed in the Racket syntax. Certainly, you can use them for a programmatic read:
> (read (open-input-string "#0=(foo . #0#)"))
#0=(foo . #0#)
But is there no place in the surface syntax where you can ever use the graph syntax? Is the `shared' library the only declarative syntax for creating cyclic data structures?
Is this a pretty straightforward restriction that was already done in Common Lisp, or did they allow wild-and-wooly, unrestricted uses of cyclic AST's that (educated guess...) result in undefined behavior by the compiler?
Dave
PS Happy Valentine's Day!