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

add --executable raw to pass just [] #259

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

gfx
Copy link
Member

@gfx gfx commented Sep 5, 2013

May be useful for vanilla JavaScript environments
such as JSFL, MongoDB, spidermonkey, or rhino

see https://twitter.com/shibukawa/status/375554447960576000 for the request

which may be useful for vanilla JavaScript environments
such as JSFL, MongoDB, spidermonkey, or rhino
@kazuho
Copy link
Member

kazuho commented Sep 9, 2013

Thank you for the pull request.

This might be the wrong time to discuss how we should fix the issue, but I am wondering if adding --executable raw is the best solution to the problem.

IMO, ideally we should never have implemented --executable flag except for chmod'ing the file for node.js. We should have invoked _Main.main in every executable mode when the script is being loaded, instead of delaying the execution until all loads are complete on the web (as is done today).

Can we still fix the issue while maintaining backwards compatibility?

@shibukawa
Copy link
Contributor

This fix won't break backward-compatibility and default compiler behavior. The resulting code behavior won't change unless you pass "--executable raw".

I listed all JavaScript environements I know:

JSX already supported

  • asynchronous - web ("load" event)
  • synchronous - node.js (but it needs command line option from process.argv)

JSX doesn't supported yet.

  • asynchronous - Chrome Apps (chrome.apps.runtime.onLaunched enent and chrome.apps.runtime. onRestarted event)
  • asynchronous - Web Worker ("message" event)
  • asynchronous - Some game engine (ng*) (main function).
  • synchronous - Rhino, SpiderMonkey (arguments object contains command line options).
  • synchronous - JSFL (it has a terrible function to load outer script files)
  • synchronous - QScriptEngine (Qt) (it has no feature to load outer script files)

"--executable raw" can cover all unsupported environments. But some case, it is not best. If there is callback functions (Chrome Apps, Web Worker), "--executable web" like options are best. And if there is some entry point function (like some game engine), If I can use native syntax, it's more easy to understand.

static function main(argv: string[]) : void
{ } = "main"

But I think "--executable raw" is a good start to support a new environment. And "Always starts from _Main.main function" is a good common sense for all JSX programmers.

@kazuho
Copy link
Member

kazuho commented Dec 4, 2013

@gfx
If you are still working on this pull request, please update the emitter to actually call _Main.main(:string[]):void, since without that, the generated code would not be an executable.

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

Successfully merging this pull request may close these issues.

4 participants