Re: Possible new issue introduced with 20140316 release
Matthew Stickney <[email protected]> Tue, 15 Apr 2014 15:54:53 -0400
| Newsgroups | gmane.lisp.clsql.general |
|---|---|
| Message-ID | <CAKH_Ld7F9K9fe1Nk7gyAq6GRnVGXn25BCkTo+uneEk9KB6wVTg@mail.gmail.com> |
On Wed, Apr 9, 2014 at 1:54 PM, Russ Tyndall <[email protected]> wrote: > The reason to switch to intern, is that intern will always return a symbol where read-from-string could return any valid lisp type. Read-from-string will also stop reading if it reaches a space while valid symbols may contain spaces. I'm already late to this party, but I'm voting for using read-from-string here. As long as you're printing with *print-readably* t, read-from-string will handle spaces, package names, things that don't look like symbols, and mixed case (e.g (make-symbol "1") => #:|1|, (make-symbol "flub") => #:|flub|). If you're going to roll your own parser, you'll have to take care to deal with syntax like the | escape, or you may wind up with symbols like #:|\|foo\||. It seems to me the easiest and most robust solution is something like: (let ((o (read-from-string s))) (check-type o symbol) o) Then you'd just have to make sure you bind *print-readably* and *read-eval* on output/input, respectively. -Matt Stickney