Fri 22 Feb 2013 06:05:30 AM UTC, comment #8:
[Adding similar handling for applet and servlet] would be more consistent, so I guess we might as well do it.
We might also want to rethink how we document the various flags, to avoid duplication. In fact, it might have sense to discuss various warnings and error message, including advice for how to work around them. (I'm working on a warning about dubious use of void forms.) Perhaps that could go in the FAQ section.
|
Fri 22 Feb 2013 01:30:52 AM UTC, comment #7:
Thanks :)
But what about my other comment:
> Also, since I'm currently around it, do you think I should add applet: and servlet: module-compile-options?
|
Fri 22 Feb 2013 12:16:17 AM UTC, comment #6:
Thanks! I check in your patch!
|
Sun 17 Feb 2013 06:58:21 PM UTC, comment #5:
Ok, I reverted to old printOptions output information and I updated documentation.
Modified Running -> Options: Add documentation about some --warn options that were not previously documented (--warn-unused) for example
Modified Running -> Compilation: Add documentation about the new way to compile Scheme program with the main: module-compile-options.
Modified Modules -> Classes -> Add valid option keys for module-compile-options.
Also, since I'm currently around it, do you think I should add applet: and servlet: module-compile-options?
(file #27480)
|
Fri 15 Feb 2013 05:01:20 PM UTC, comment #4:
If it is handled "implicitly", that is fine.
I think the older printOptions output for --main may have been more precise:
Generate an application, with a main method
vs
generate module with a main method
"application" is more specific term in the Java world.
(Though lower-case "generate" is probably better.)
|
Fri 15 Feb 2013 04:46:41 PM UTC, comment #3:
I just tested it and it works as expected, adding `--main` to `kawa.repl` will generate a main method for all modules unless a module speicify `(module-compile-options main: #f)` which overrides the `--main` argument.
If you still don't like the removal of the explicit handling of `--main`, I will revert it back, no problem :)
|
Fri 15 Feb 2013 04:21:05 PM UTC, comment #2:
I removed it from `repl.java` because it is now handled like what is done for `--warn-unreachable` or the like. In repl arguments handling, there is a clause that is reached when the argument has not match previous clauses `else if (arg.length () > 0 && arg.charAt(0) == '-')`.
In this clause, it checks if the argument is a valid compilation option, like stated by the following comment: `// See if arg is a valid Compilation option, and if so set it.`
This is why I removed it from there because it became redundant. I tested it and the `--main` flag is still working as before. I will check again to be 100% sure it works.
I will report back. Moreover, I will do the documentation update this weekend.
|
Fri 15 Feb 2013 12:43:43 AM UTC, comment #1:
Removing the "traditional" --main flag isn't acceptable, I'm afraid. Note that when I added full-tailcalls support to module-compile-options I did not remove the "traditional" flags.
An easy way to support --main is to change the default in
mainMethodVariable. E.g. if we add a setDefaultValue to OptionInfo we can do:
Compilation.mainMethodVariable.setDefaultValue(true);
I think the name 'mainMethodVariable' is awkward. (I realise it follows the style of older options.) Perhaps mainMethodOption is better.
The source for the documentation is in doc/kawa.texi.
|
Thu 14 Feb 2013 05:07:40 PM UTC, original submission:
As discussed on the mailing-list [here](http://sourceware.org/ml/kawa/2013-q1/msg00010.html), I added a new `module-compile-options`.
The patch attached to this bug report adds a new `module-compile-options main:` that can be set on any module. This option will then let Kawa know that it must generate a main method for the currently compiled module.
The `--main` argument flag can still be used as before. This is usefull to create multiple "runnable" classes and compiling with other classes that are not intendend to be runnable.
Use it as follow:
(module-compile-options main: #t) ;; Will generate a main method
(module-compile-options main: #f) ;; Will never generate a main method, even if --main flag is passed to Kawa compiler
;; If main: compile options is not present, it will generate a main method only if --main flag is passed to Kawa compiler
The current patch does not update the documentation. I would be glad to update it if you can point me where the source is.
Regards,
Matt
|