runtimejs / runtime

[not maintained] Lightweight JavaScript library operating system for the cloud
http://runtimejs.org
Apache License 2.0
1.93k stars 128 forks source link

Kernel APIs #23

Closed iefserge closed 10 years ago

iefserge commented 10 years ago

Here is the current version of kernel APIs (global functions available to all programs):

{
  data: { ... }
  env: { ... }
  system: { ... }
}

Includes all data available to program. Where: data - data provided by parent program env - 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 object system.fs.current (not inherited from parent).

If you have any comments or suggestions, we can discuss it here.

UPDATED (latest version):

heapwolf commented 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

PROCESS

iefserge commented 10 years ago
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.

heapwolf commented 10 years ago

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.

iefserge commented 10 years ago

@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.

heapwolf commented 10 years ago

ah, yeah i see what you mean. :+1: I like isolate.env.stdout the best.

iefserge commented 10 years ago

Now API looks like this:

heapwolf commented 10 years ago

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.

iefserge commented 10 years ago

Added API wiki page https://github.com/runtimejs/runtime/wiki/api

heapwolf commented 10 years ago

No longer relevant after latest discussions.