This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Compiling packages with gnu.expr


Daniel Bonniot wrote:

>- would it make sense to create a ModuleExp for each java package
>generated, possibly as children of a root ModuleExp?
>
Possibly in theory.  My guess is that it would be easier to make things
work with a single ModuleExp.  (Of course if you're compiling a Java
course file you can only generate (part of) a single package each time.)

>- How can I declare the package each ClassExp belongs to?
>
I would just give it a fully-qualified name.  Certainly gnu.bytecode knows
nothing about packages, and just uses fully-qualified class names, without
any special interpretation.

>- It seems some changes should be made, if for nothing else to the name
>generation mechanism in Compilation.generateClassName: it creates names
>of the form <root moduleExp>$name
>
That is consistent with how inner classes would be copiled, so it at least
sometimes appropriate.  I have thought that you want to be able to override
the class names.  For example, if the ClassExp is given a name 
containing a '.',
then we should treat that as the fully-qualified class name, and not prepend
the module name.  But even so, we probably want to not prepend the
module name in some cases even when a simple name is specified.  At the
Scheme level, I have thought that define-simple-class would not prepend
the module name, but define-class does.  At the Java level, it should be
easily enough to set teh class name explicitly, perhaps with some minor 
changes.

>Possibly, there could be a flag somewhere to indicate what style of
>naming one wants (Scheme or Java). Or should it be by subclassing
>ModuleExp with say a PackageExp? Would you be interested in me
>contributing this extension (that would be backward compatible with the
>current API of course)
>
Depends what the purpose is.  The various sub-classes of ScopeExp are to
manage *source-level* name spacing, and are not meant to correspond directly
to "scoping" in the generated classes.  If you're trying to contro the 
package
and class names for a ClassExp, you don't need a PackageExp - just set the
name of the ClassExp directly.  If having PackageExp would be help in the
semantic analysis phase of your compiler, then they may be reasonable.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]