Is anyone using BuckleScript (or even JSOO) to target Microsoft’s JScript language in the Windows Scripting Host environment? Since BS can output ES5, a fairly vanilla JS, it should (in theory) be possible. The main problems (as usual) would be to minimise use of the OCaml stdlib, and to write bindings for the common WSH API objects (FileSystemObject
, TextStream
, etc.).
Yes, it is the intended use case. How is JScript different from Node??
Bob, good question. I’m thinking JScript’s library doesn’t support as much as ES5 does, e.g. it has a limited set of Array
methods: https://msdn.microsoft.com/en-us/library/f0eay1h3(v=vs.100).aspx
I have an old Windows machine lying around somewhere; I’ll try it out and report back soon.
OK, test successful: I was able to bind to JScript, create an ActiveX MSXML2.XMLHTTP
object, and download a web page, all running in the Windows script environment. Here’s the main module: https://github.com/yawaramin/wsh-bs-test/blob/c5eb417cec0e0a04397f32042b3bcff337e10cd2/src/main.ml