Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternate scripting lanaguage for IO #6

Open
matthewfl opened this issue Jan 27, 2015 · 1 comment
Open

Alternate scripting lanaguage for IO #6

matthewfl opened this issue Jan 27, 2015 · 1 comment

Comments

@matthewfl
Copy link
Owner

Currently ilang is far behind other programming languages out there in terms of features and ease at which a task can be accomplished. Currently, if someone wants to preform some io task, say reading email over imap, they will have to custom write a module in C++, which means that they are going to have to find and integrate a C++ imap module. The alternate that I am proposing that another scripting language is embedded into ilang, so that it can be used to handle all of the i/o interfaces. This would mean that someone could possibly use a python or node module to preform the imap manipulation, or write a small (~25 lines ideally) wrapper around already existing libraries to make them capable.

Feature Nodejs Python
Speed v8 with Jit Bytecode
IO model Event loop Threads
Library more "pure" js libraries & thus interfaces are often reimplemented on top of TCP with various quality Tend to wrap C libraries that complete a given task
Conflicting library deps node_modules dir is used to allow multiple versions of a dep to be loaded at one time does not support more then one version of a library out of the box
Language features Prototype based system, weak typing class based, kwargs support on functions
Embedding api Would require minial changes to internals, but mostly v8 Supports an embedding api
@matthewfl
Copy link
Owner Author

Sample node:

var requests = require('requests');
var ilang = require('ilang');

exports.request = function(args) {
  var ret = ilang.promise();
  requests(args, function(err, resp) {
    if(err)
      ret.reject(err); // idk if want to use reject? as then the error handling
    else
      ret.resolve(resp);
  });
  return ret; // ilang will automatically recognize an ilang promise
};

Sample using ilang:

from i import node
from i import promise

_http_request = node.require('requests');
request = {|Object args|
  ret = promise.promise.new(); // should ilang importing classes specifically
  _http_request(args, {|NotNull err| ret.reject(err); } + {|err, resp| ret.resolve(resp) });
  return ret.wait(); // blocks until the promise is resolved
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant