Closed desm closed 9 years ago
You're right, it's highly possible. I guess it was the first syntax, and the I've must have changed it later, to match ES6 "import" syntax. I'll check the docs.
Regarding nodegit:
Have you tried _/devel/source/v0.8/utility/mkInterface_?
_mkInterface_ does var obj = require('nodegit')
and then tries to inspect obj to create the interface file. Does it work with nodegit?
... I was checking nodegit, and the require mechanism seems a little convoluted, maybe mkInterface cannot extract the methods, but you can still write nodegit.interface.md manually.
e.g: at http://www.nodegit.org/#Example
var open = require("nodegit").Repository.open;
It means that _require("nodegit")_ returns an object having a property _Repository_, having a function open, and it seems that open returns a promise?
So the interface should be: (file: nodegit.interface.md)
public class promise
method then(fn)
public class Repository
method open(name:string) returns promise
Interesting! I wanted to ask you about this actually. I will give it a try later.
On Tue, Jan 13, 2015 at 9:02 AM, Lucio M. Tato notifications@github.com wrote:
Regarding nodegit: Have you tried /devel/source/v0.8/utility/mkInterface? mkInterface does var obj = require('nodegit') and then tries to inspect obj to create the interface file. Does it work with nodegit? ... I was checking nodegit, and the require mechanism seems a little convoluted, maybe mkInterface cannot extract the methods, but you can still write nodegit.interface.md manually.
e.g: at http://www.nodegit.org/#Example
var open = require("nodegit").Repository.open;
It means that require("nodegit") returns an object having a property Repository, having a function _*open__, and it seems that open_ returns a promise?
So the interface should be: (file: nodegit.interface.md http://nodegit.interface.md)
public class promise method then(fn)
public class Repository method open(name:string) returns promise
— Reply to this email directly or view it on GitHub https://github.com/luciotato/LiteScript/pull/13#issuecomment-69747650.
Hi! I had a use case where I wanted to import the 'fs-extra' module. So I needed a way to produce the following in javascript:
I found somewhere in the code that LiteScript is meant to support the syntax
import fse='fs-extra'
for this purpose, so I tried to implement that.However, because my script uses a non-JS-pure module (nodegit), for which I cannot make an interface (is this a correct assumption?), I need to use the 'lite -s' flag. So to keep things simple as it is the first time I update the grammar and production files, this implementation of the import x = 'a-b-c' is specific to the use case when compiling a single file (when the '-s' param is used).
Not sure if you will want these changes or not. But offering it if this is an acceptable solution for the time being.