Closed IngwiePhoenix closed 10 years ago
Oh I forgot: #include(...)
works too.
#include("OJFoundation/main.oj");
//...
https://github.com/IngwiePhoenix/connect-oj/commits?author=IngwiePhoenix
I uploaded my current progress. The only part missing is being able to use ojc()
. Otherwise, it runs almost as it should. If you only open it with ?runtime
, then it will grab the runtime.js located in the same folder as ojc.js. So far, so good. :)
On a side note, AFAIK, Objective-J does not have such an aproach yet.
Good call, ojc needs to be documented more :) Do you need sync behavior? Or is async ok? I'd rather keep it async for now, as it opens up more possibilities for the future.
Async works just fine. I just need its first parameter documented. :)
Just looked at the short API doc and got confused at .files
and .contents
. I belive that the order matters, as in:
var opt = {
files: ["main.oj", "other.oj"],
contents: ["contents of main.oj", "contents of other.oj"]
};
But, wouldn't it be easier to just have a files object?
var opt = {
files: { "main.oj": "...", "base.oj": "..." }
};
Your way is definitely cleaner, let me try to remember why I did it with two keys. :)
BTW, if you had skype, we could use that to talk about oj stuff - instead of flooding the issues section. :) my skype is: wlaningwie
Note: going with Ingwie's suggestion and making files an object of filename=>content pairs.
Slight modification ;) The reason for the two keys was to preserve the original order of the passed-in files. While oj 1.0 is much better than 0.x at analyzing dependencies, I think there are still some cases where order is important.
That said, I dislike files
and contents
as siblings which must be kept in sync. We should just have files
.
If files
is an Array of String objects, have the compiler read each file for the contents.
If files
is an Array of Object objects, both the filename and the contents can be provided. This also opens up per-file compilation options in the future.
All of these should be on master now. Ingwie, please feel free to file more bugs if you have more questions :)
As I am currently working on my middleware for Connect to preprocess and compile OJ files to JS, I have come to a few questions. Mind you, I am using the 1.0 branch.
ojc()
?ojc()
?I am using a minimalistic preprocessor that you may want to look at when I uploaded the code. It basically allows something like this:
Kind regards, Ingwie