[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [plt-scheme] eval question



> > why it is 
> > considered evil (or at least bad form) to use eval outside of a
top 
> > level REPL? 
> 
> I think it is fine as long as you execute the quoted code in a fresh
> environment.  If you execute it in the same environment your program

> is operating in, you can be in for some nasty surprises as it grabs 
> your local variables.

I found that very practical when saving the settings of a program (the
installer of the matlab-interface i wrote lately) to the hard-disk. If
they are needed again I simply do

(with-input-from-file path
  (lambda ()
    (eval (read))))

Sebastian