bugKawa - Bugs: bug #38332, Added a new module-compile-options

 
 

bug #38332: Added a new module-compile-options

Submitted by:  Matthieu Vachon <maoueh>
Submitted on:  Thu 14 Feb 2013 05:07:40 PM UTC  
 
Category: Code generationSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

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.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
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?

Matthieu Vachon <maoueh>
Fri 22 Feb 2013 12:16:17 AM UTC, comment #6:

Thanks! I check in your patch!

Per Bothner <bothner>
Project AdministratorIn charge of this item.
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)

Matthieu Vachon <maoueh>
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.)

Per Bothner <bothner>
Project AdministratorIn charge of this item.
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 :)

Matthieu Vachon <maoueh>
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.

Matthieu Vachon <maoueh>
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.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
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

Matthieu Vachon <maoueh>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #27480:  module-compile-options-main.patch added by maoueh (11KiB - application/octet-stream - Patch Version #2)
file #27463:  module-compile-options-main.patch added by maoueh (4KiB - application/octet-stream - Patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bothner (Posted a comment)
  • -unavailable- added by maoueh (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 22 Feb 2013 12:16:17 AM UTCbothnerStatusNone=>Fixed
      Assigned toNone=>bothner
      Open/ClosedOpen=>Closed
    Sun 17 Feb 2013 06:58:21 PM UTCmaouehAttached File-=>Added module-compile-options-main.patch, #27480
    Thu 14 Feb 2013 05:07:40 PM UTCmaouehAttached File-=>Added module-compile-options-main.patch, #27463

    Back to the top


    Powered by Savane 3.1-cleanup1