First, PAIP is written for Common Lisp, not Scheme, so I don't know that he'd say the same thing. CL macros do much the same thing as eval
, although at compile time instead of run time, and there's other things you could do. If you'd show me an example of using eval
in Common Lisp, I could try to come up with other methods of doing the same thing.
I'm not a Scheme programmer. I can only speak from Norvig's perspective, as a Common Lisp programmer. I don't think he was talking about Scheme, and I don't know if he knew or knows Scheme particularly well.
Second, Norvig says "you are probably doing the wrong thing" rather than "you're doing the wrong thing". This implies that, for all he knows, there's times when eval
is the correct thing to use. In a language like C, I'd say the same thing about goto
, although they're quite useful in some restricted circumstances, but most goto
use is by people who don't know any better.