basically, if I do:

> e = Expr(:quote, :(:x)) # (quoting a symbol)
> show(e)

*:($(Expr(:quote, :(:x))))*

> print(e)

*$(Expr(:quote, :(:x)))*

> string(e)

*"\$(Expr(:quote, :(:x)))"*

> parse(string(e))

*:($(Expr(:$, :(Expr(:quote,$(Expr(:quote, :(:x))))))))*


that's not the same expression as represented by the string. Then when I go 
to eval it (which should still work, semantically speaking)

*ERROR: unsupported or misplaced expression $*


Is there a way around this? I'd like to make an expression a string, print 
it to a file, then slurp it up later and eval it.

At the very least, there should be a consistent way to stringify and 
reparse/eval expression objects, even if they look ugly like 
:($(Expr(:quote, :(:x)))). I'd hate to have to reimplement the whole 
printing of every expression ever in order to make this work (there doesn't 
seem to be a way to extend a method, like print or show, to only work on 
expressions with a particular head?)



Vishesh

Reply via email to