This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: define-alias question
- From: Per Bothner <per at bothner dot com>
- To: Matthieu Vachon <matthieu dot o dot vachon at gmail dot com>
- Cc: "kawa at sourceware dot org" <kawa at sourceware dot org>
- Date: Wed, 17 Jul 2013 23:49:51 -0700
- Subject: Re: define-alias question
- References: <CAOTvmokJvFFYkeCJPvD-VTmZNQ-n=S1v7AdyyTwyjDUQdbj3Vw at mail dot gmail dot com>
On 07/17/2013 07:29 PM, Matthieu Vachon wrote:
Hi all,
Is it intended that `define-alias` are exportable? From my point of
view, `define-alias` are used mainly to reduce variable name length
and hence, have little usage when exported and reuse across multiple
modules.
The aliases enable us to have more readable code by aliasing java
fully qualified name to their simple name. However, we often hit
warnings saying that some alias is already specified from another
module. This happens when the module export all of its definitions and
this module is imported in another module.
I think this should not happen because in my opinion, alias should be
private to the module where they were defined. I see not much points
in making them exportable other then creating conflicts. Of course, I
could oversee some really valid use-cases that would involve exporting
aliases.
For consistency, I think it would be possible to export an alias.
However, perhaps it would only be exported if explicitly specified
as exported. That would be an incompatible language change.
What do people think of that?
The implementation appears simple: in Translatotor.java
method finishMethod do something like:
if (mexp.getFlag(ModuleExp.EXPORT_SPECIFIED)
|| (generateMainMethod() && ! immediate))
{
...
}
else if (decl.isAlias())
decl.setPrivate(true);
However, I haven't tested this.
--
--Per Bothner
per@bothner.com http://per.bothner.com/