This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Question about command-line-arguments and main method
On 02/04/2013 10:15 AM, Matthieu Vachon wrote:
I hit a small problem with the variable `command-line-arguments`. The
compiler is always complaining that this variable is not declared.
There are a number of solutions.
The simplest and best is to use the R6RS/R7RS command-line function.
See http://www.gnu.org/software/kawa/Processes.html
More generally, to shut up "no declaration seen" warnings you
can add a define-variable declaration:
(define-variable command-line-arguments)
You can also nest the variable reference in a with-compile-options form:
(with-compile-options warn-undefined-variable: #t EXPRESSION)
See http://www.gnu.org/software/kawa/Module-classes.html
I should probably fix command-line-arguments so it is always seen,
but given that the standards-based command-line function seems
preferable, it's a pretty low priority.
Is it a problem with how I use the variable? Is it a bug in the
compiler? This is a problem because we plan to treat error as warning
using `--warn-as-error` and this prevents compilation of those units.
I certainly want to encourage this practice!
I would also like to know if it's possible to produce a `.class` that
has a static main method in it so it's possible to call directly (.i.e
`java org.kawa.main` for example)?
You mean the --main Kawa flag?
See http://www.gnu.org/software/kawa/Compiling.html#Application-compilation
(If I come across as implying you should have read these answer in the
manual,
that is not my intention. It's a big language, and a big manual, and even
I don't remember it all. All the same, if you have concrete suggestions for
how the documentation can be improved, that is always welcome.)
--
--Per Bothner
per@bothner.com http://per.bothner.com/