On Sun, May 02, 2021 at 10:45:10AM +0300, Jean Louis wrote: > * Michael Heerdegen [2021-05-02 08:43]: > > Stefan Monnier writes: > > > > > I know I sound like a broken clock, but [...] > > > > I think you would sound more like an unbroken clock if you would shortly > > tell the disadvantages of using `eval', then people would be more open > > to alternatives. > > If possible, let me know one bad example in my context of expanding > plain text with embedded Emacs Lisp. I tried to offer an explanation which you chose to ignore [1] . I think the problem is more subtle, and thus difficult to explain in just a few words. If it were that easy to explain clearly, I think Stefan would have done that already. > Like how it can go wrong that in same time cannot go wrong in same > replacement method? > > And which replacement method could I use? > > Like why did Lisp authors the `read-from-string' function if it should > not be used? It is quite common that its result will be given to `eval'. It's not as clear-cut as "should not be used". Rather something along the lines of "should be used with care" [2]. Template expansion is one of those borderline cases, but if you look at all those modern template expanders out there [3], you'll realise that they all have some kind of "custom evaluator", where you explicitly provide an environment, instead of just punting to `eval' and saying "use... uh, whatever". For a reason [4]. Cheers [1] Which, to be honest, is somewhat confusing to me. [2] Yes, do it: enter the phrase "eval is evil" into your favourite search engine. [3] e.g. Perl's Text::Template, Python's Jinja2, you name it. [4] Perhaps one short way to express it would be "this havocs the compiler". Dunno. - t