This project is read-only.

Incremental Compilation?

Aug 16, 2010 at 9:06 PM
Can I compile two different scripts into the engine and then have them execute in the same scope?
Aug 17, 2010 at 11:51 AM
As soon as you compile a script into the engine, any public variables that you created are live in that engine. So if you compile two scripts into the engine, as long as they don't overwrite each other, then they should both be available for you.
Aug 17, 2010 at 1:08 PM
Yep, that worked! Anything that saves a chunk of CPU time...

Thanks for all of your help.
Jan 12, 2011 at 10:03 PM

Hi, guys. First of all, great project, I am really impressed!

Maybe I don't understand something in comment above, but why following code throws 'System.Exception : ReferenceError: getName is not defined':

            V8Engine engine = V8Engine.Create();
            var coreScript =
                engine.Compile(@"
var counter = 0;
function getName() {
  return 'world';
}
");

            var script = engine.Compile(
                @"
function sayHello(x) {
  counter++;
  return 'Hello ' + x + '! Executed ' + counter + ' times.';
}
sayHello(getName());
");
            Console.WriteLine(engine.Execute(script));
            Console.WriteLine(engine.Execute(script));
            Console.WriteLine(engine.Execute(script));