This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: file name of java class generated by kawa
- From: Per Bothner <per at bothner dot com>
- To: kawa at sourceware dot org, Damien Mattei <damien dot mattei at unice dot fr>
- Date: Thu, 17 Sep 2015 03:18:03 -0700
- Subject: Re: file name of java class generated by kawa
- Authentication-results: sourceware.org; auth=none
- References: <55FA86F9 dot 2010308 at unice dot fr>
On 09/17/2015 02:25 AM, Damien Mattei wrote:
i put the example in a file named 2d-vector.scm
and compiled it with the command :
java -jar /usr/local/lib/kawa-2.0.jar -C 2d-vector.scm
and i get those file as result ,files that seems ok for use with other
classes but i'm surprised of the names that begin with $ character:
$N2d$Mnvector.class
is it a convention ? it's not really pretty ... is there a way to have
just a 2d-vector.class file name?
This is an issue I agonize over. "2d-vector" is valid class name for
the virtual machine, but it is not a valid *Java* class name. Thus
if we created the class "2d-vector" there would be no way to reference
the class from Java code except by using reflection.
The question is which is more important:
(a) a clean translation from Scheme name to class name?
(b) being able to access the class from Java without reflection?
I don't know the right answer. So I've stuck with the status quo,
inherited from Old Days when the restrictions on class names were stricter.
For an in-depth-disussion see:
https://blogs.oracle.com/jrose/entry/symbolic_freedom_in_the_vm
what is the use of the other generated file:
$N2d$Mnvector$frame.class
$frame classes are used for implementing closures, basically.
In the 2d-vector class it turns out it isn't really needed,
so generating it may be a bug, but there are other cases it s needed.
The "invoke" branch (in Subversion) of Kawa implements closures
differently (using MethodHandles on Java 7 or newer), and
that dos not create the $N2d$Mnvector$frame class.
--
--Per Bothner
per@bothner.com http://per.bothner.com/