|
From: Craig L. <cra...@gm...> - 2016-01-26 17:14:16
|
On Tue, 2016-01-26 at 09:16 -0600, Robert P. Goldman wrote: > On 1/26/16 Jan 26 -8:35 AM, Michael Hannemann wrote: > > Manuel Giraud wrote: > > > Stas Boukarev <sta...@gm...> writes: > > > > > > > > > Using READ for reading stuff that is not lisp source code > > > > > > is a really > > > > > > bad idea. Never do it. > > > > > Why? > > > > Because it's slow and unsafe. > > > > > > I'm curious. I generally use read-from-string out of lines to > > > parse > > > float for instance. How should I do then without using the CL > > > parser? > > I figure it depends on your needs & infrastructure? To help with > > the > > unsafe part, you can wrap it in (let ((*read-eval* nil)) ...). > > In addition to the safety issue, READ can be very slow. If you think > about it, it can do almost arbitrary computation. > > If you know the type of the data you are reading, you will find that > parsing it specially will be a huge win. Or, if it suits your purpose, you can build a custom readtable that parses things exactly the way you want and use that with READ. I use this method to parse ISO 10303-11 schema files and ISO 10303-21 data files. It works quite well for me. Craig |