Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Some basic compiled script questions

0
0
Hi Eric,

Why are compiled scripts available to evaluate but not to execute?

Script compilation is a V8-specific feature, and since in JavaScript evaluation and execution are the same thing, there's no need for two sets of methods. Evaluation and execution are currently different only in VBScript; V8ScriptEngine has some execution methods only because it inherits them from ScriptEngine.

Are executed scripts always compiled internally?

In V8ScriptEngine, all execution and evaluation methods that accept script code in string format internally perform a compilation step followed by an execution step.

Is there any advantage to adding host objects/types before script compilation or is that a runtime only thing?

Our understanding is that script compilation is not affected by the execution environment, which includes the global object hierarchy. In fact, compiled scripts are reusable across V8ScriptEngine instances that share the same V8 runtime.

Cheers!

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images