Is eval the defmacro of javascript?

Posted by Florian Margaine on Programmers See other posts from Programmers or by Florian Margaine
Published on 2012-10-05T12:58:56Z Indexed on 2012/10/05 15:52 UTC
Read the original article Hit count: 486

Filed under:
|

In Common Lisp, defmacro basically allows us to build our own DSL.

I read this page today and it explains something cleverly done:

But I wasn't about to write out all these boring predicates myself, so I defined a function that, given a list of words, builds up the text for such a predicate automatically, and then evals it to produce a function.

Which just looks like defmacro to me.

Is eval the defmacro of javascript? Could it be used as such?

© Programmers or respective owner

Related posts about JavaScript

Related posts about lisp