file name of java class generated by kawa

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

file name of java class generated by kawa

Damien Mattei
hello,

i'm newbie to kawa ,nor scheme,nor java, i had compiled the kawa example
point 2D class

( http://www.gnu.org/software/kawa/Defining-new-classes.html )

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?

what is the use of the other generated file:

$N2d$Mnvector$frame.class

Regards,

Damien
Reply | Threaded
Open this post in threaded view
|

Re: file name of java class generated by kawa

Per Bothner


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
[hidden email]   http://per.bothner.com/
Reply | Threaded
Open this post in threaded view
|

Re: file name of java class generated by kawa

Damien Mattei
thanks for your response...

i simply change the class name in Vector2D and i get a smart
 Vector2D.class
that is more human freindly.

see my next questions in a few minutes ;-)

Damien

Le 17/09/2015 12:18, Per Bothner a écrit :

>
>
> 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.