dalejung / inode

Interactive Node.js
MIT License
3 stars 1 forks source link

Add synchronizing. #22

Closed dalejung closed 11 years ago

dalejung commented 11 years ago

Want the ability to run blocks of code synchronously.

The basic sync wrappers for functions exist here.

https://github.com/dalejung/inode/blob/master/lib/sync/index.js

Right now it handles async methods that return promises. The .sync attribute will call the function and Fiber.run when the promise is resolved.

Further issues:

  1. Should the %fun auto run the code with a Fiber?
  2. Should each line run within a fiber?
dalejung commented 11 years ago

When running stuff in Fiber, how do I get access to the function global? I want the ability to auto hoist the variables defined within the function to another scope.

I could run each line within a contextify, actualy I run everything within the context stuff anyways...

So I would need to wrap the actual contextify.run or vm.runInThisContext.

Verify that the vm functions will still work within a Fiber

dalejung commented 11 years ago

Just verified that the Fiber works within nested runs as well.

dalejung commented 11 years ago

Thinking about it, this is done on the inode side.