patternMinor
A faster, leaner JavaScript for scientific computing: what features should I keep?
Viewed 0 times
whatjavascriptscientifickeepleanerfasterforshouldfeaturescomputing
Problem
Here I'm really interested in lowering barriers to mathematical education.
Target:
I'd like to see created for the JavaScript community, an equivalent of the Python-based/linked scientific and high-performance computing libraries (great lists of which are available through Sage and otherwise). And I want that, because I'd like to make it easy for people who learn JavaScript to get into scientific and numerical computing without having to learn Python (& company). (I know it's easy to learn Python, as I basically did it at some point, but this suggests that perhaps it'll be easy to compile some restricted subset of JavaScript to Python.)
Hypothesised method:
I'm primarily interested in a new language with minimal difference from JavaScript, because the market ("human compilers") I'm targeting are programmers who already know JavaScript. What I want to target those people for, is to give them a minimally different language in which to write code that compiles to faster C, in the manner that RPython and Cython do for Python. I'm willing to throw out a lot of JavaScript features, I just want to be careful to add a minimum number of features back in. I'll definitely be looking at Lua, Dart, ECMA Harmony (which has no formal date of release, or am I mistaken?), etc. as these are all close resemblances to contemporary (2012) implementations of JavaScript.
Questionable Motivations:
I'm personally willing to learn any language/toolset that gets things done faster (I'm learning Erlang myself, for this), but here, I am specifically interested in lowering the bar (sorry) for other people who may not have such willingness. This is just one of those "want to have my cake, and eat it too, so I am putting some time into researching the problem" situations. I have very limited prior experience in computer language design, but so far from a hacking-the-ecosystem point of view, the problem seems interesting enough to study, so, I hope to be doing more of that soon.
Target:
I'd like to see created for the JavaScript community, an equivalent of the Python-based/linked scientific and high-performance computing libraries (great lists of which are available through Sage and otherwise). And I want that, because I'd like to make it easy for people who learn JavaScript to get into scientific and numerical computing without having to learn Python (& company). (I know it's easy to learn Python, as I basically did it at some point, but this suggests that perhaps it'll be easy to compile some restricted subset of JavaScript to Python.)
Hypothesised method:
I'm primarily interested in a new language with minimal difference from JavaScript, because the market ("human compilers") I'm targeting are programmers who already know JavaScript. What I want to target those people for, is to give them a minimally different language in which to write code that compiles to faster C, in the manner that RPython and Cython do for Python. I'm willing to throw out a lot of JavaScript features, I just want to be careful to add a minimum number of features back in. I'll definitely be looking at Lua, Dart, ECMA Harmony (which has no formal date of release, or am I mistaken?), etc. as these are all close resemblances to contemporary (2012) implementations of JavaScript.
Questionable Motivations:
I'm personally willing to learn any language/toolset that gets things done faster (I'm learning Erlang myself, for this), but here, I am specifically interested in lowering the bar (sorry) for other people who may not have such willingness. This is just one of those "want to have my cake, and eat it too, so I am putting some time into researching the problem" situations. I have very limited prior experience in computer language design, but so far from a hacking-the-ecosystem point of view, the problem seems interesting enough to study, so, I hope to be doing more of that soon.
Solution
If you want to use JavaScript for scientific computing, why not try Node.js? Node is based on Google's V8 engine with some additional functionality for interacting with the file system, writing servers and linking to C and C++ libraries (this is definitely not an exhaustive list). It sports fast execution times and provides an interactive console as well as a way to execute your programs from the command line. I found @DaveClarke's comment about Python acting as "glue code" interesting because of the wording. Here is an excerpt from the Node documentation on addons:
Addons are dynamically linked shared objects. They can provide glue to
C and C++ libraries.
Node also has an excellent package manager called NPM, which would make it easy to share scientific modules which you have written. The NPM repository already contains some scientific modules, such as "natural" (for natural language processing) or "clusterfck" (a clustering library). There are most definitely many other libraries out there for a variety of applications.
The great thing about this solution is that you wouldn't have to modify JavaScript or create a new language. The syntax is essentially the same, but your code does not need a browser to execute. If you plan to follow up with node, a good first step might be to start creating addons for existing open-source scientific libraries written in C and C++, or you could port them to JavaScript. I was actually thinking about using node for scientific programming today which is what led me to this question. It would be great to see more robust tools like you find in Python.
I initially had links to natural and clusterfck, but I do not have enough rep to post them. Luckily, they come up as the first results if you google "clusterfck node" and "natural node".
Addons are dynamically linked shared objects. They can provide glue to
C and C++ libraries.
Node also has an excellent package manager called NPM, which would make it easy to share scientific modules which you have written. The NPM repository already contains some scientific modules, such as "natural" (for natural language processing) or "clusterfck" (a clustering library). There are most definitely many other libraries out there for a variety of applications.
The great thing about this solution is that you wouldn't have to modify JavaScript or create a new language. The syntax is essentially the same, but your code does not need a browser to execute. If you plan to follow up with node, a good first step might be to start creating addons for existing open-source scientific libraries written in C and C++, or you could port them to JavaScript. I was actually thinking about using node for scientific programming today which is what led me to this question. It would be great to see more robust tools like you find in Python.
I initially had links to natural and clusterfck, but I do not have enough rep to post them. Luckily, they come up as the first results if you google "clusterfck node" and "natural node".
Context
StackExchange Computer Science Q#1693, answer score: 8
Revisions (0)
No revisions yet.