[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [plt-scheme] eval question
At 11:39 PM +0200 6/5/02, Sebastian H Seidel wrote:
> > > 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
Not only does this strike me as a bad idea from a
thinking-about-your-program-and-documenting-it-clearly standpoint,
it's also a staggering security problem.
john "but I'm the only one who will ever run this code!" clements