Closed iefserge closed 10 years ago
Initial thoughts: if we're calling a runnable javascript file a program
, something spawned
, the closest analog seems like process
or even better, isolate
since it's spawned by the isolateManager
. What about something more like...
kernel.log([args, ...])
kernel.version()
isolate.exit([value])
isolate.log(...)
isolate.stdout(...)
isolate.stdin(...)
isolate.stderr(...)
isolate.args()
isolate.data
isolate.stdout(...)
isolate.stdin(...)
isolate.stderr(...)
@hij1nx Why global functions for streams? I think streams should be a part of the program environment provided by shell.
oops, i didn't mean for those to be functions. not global functions, but members attached to the isolate
object, similar to process.stdout
etc. in node.
isolate.stdout
isolate.stdin
isolate.stderr
@hij1nx I like the idea to rename global runtime
object to isolate
.
I was thinking about isolate.env().stdout
or isolate.env.stdout
because it's an environment object.
ah, yeah i see what you mean. :+1:
I like isolate.env.stdout
the best.
Now API looks like this:
isolate.data
isolate.env
isolate.system
isolate.exit()
isolate.log()
kernel.version()
// maybe put versions into isolate.system.version()
?thats quite nice. I think the kernel
object is a nice way to expose things about the kernel that don't directly relate to isolates, like kernel.version
.
Added API wiki page https://github.com/runtimejs/runtime/wiki/api
No longer relevant after latest discussions.
Here is the current version of kernel APIs (global functions available to all programs):
runtime.args()
- get program arguments. Returns object likeIncludes all data available to program. Where:
data
- data provided by parent programenv
- environment provided by parent program (usually inherited). For example, standard streams are part of the environment. (env.stdout
,env.stderr
,env.stdin
)system
- environment provided by kernel (according to program access level, system services like filesystem, network, etc). For example, each program is chrooted to directory where it's *.js file is located, so it gets it's own accessor objectsystem.fs.current
(not inherited from parent).runtime.exit([value])
- exit program and return optionalvalue
to parent programruntime.log([args,...])
- write to kernel log (console.log
writes to stdout by default)runtime.version()
- get system versionIf you have any comments or suggestions, we can discuss it here.
UPDATED (latest version):
isolate.data
- data provided by parent programisolate.env
- environment provided by parent programisolate.system
- environment provided by kernelisolate.exit()
- exit programisolate.log()
- write to kernel logkernel.version()
- get system version