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



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

Not exactly: an inner class in java would be prefixed by the englobing
class name, not the (global) module name.
I have written code for that: follow the <code>outer</code> links until
I find a classExp, and use its name as the prefix if it is found.


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

So it could be the job of the LambdaExp/ClassExp to compute its bytecode
name, and it can fetch the prefix from the compilation if it wants. Thus
we could remove generateClassName from Compilation, and add
getJavaName(Compilation) to LambdaExp. Compilation should probably keep
a mechanism to create unique names by adding numbers at the end
(generateUniqueName ?).
I am puzzled by the existing LambdaExp.getJavaName(), as it doesn't
return the final bytecode name. It is needed? For debugging only?

Or do you have another design in mind? Some way or another it should be
possible to use fully qualified name, and to have frames and inner
classes named after the englobing class.

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

What is the "scoping" in the generated classes? The
private/default/protected/public visibility in the JVM spec?

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

Yes, after we change the name generation to make it possible.

> If having PackageExp would be help in the
> semantic analysis phase of your compiler, then they may be reasonable.

I have another AST for typechecking, that is "compiled" into gnu.expr
expressions, so my specific analyses go there.


Daniel


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