[quickjs-devel] Create function from string?

  • From: Alastair Coote <me@xxxxxxxxxxx>
  • To: quickjs-devel@xxxxxxxxxxxxx
  • Date: Mon, 3 Aug 2020 11:33:24 -0400

Hi all,

Just getting to grips with the API so apologies if I've missed some
existing functionality. But I'd like to create a function from a string,
e.g. provide a list of argument names and then a function body (this is
something JavaScriptCore does and I'm trying to mirror it).

I know I could use JS_Eval and create the function() {} wrapper in a string
too, but that opens the door to the provided function body being able to
escape the function just by throwing in an extra }. Ideally it would be
more secure than that.

Any ideas?

Thanks,
Alastair

Other related posts:

  • » [quickjs-devel] Create function from string? - Alastair Coote