Proposal: Package aliases
Bill Baxter
dnewsgroup at billbaxter.com
Fri May 16 12:14:24 PDT 2008
Bill Baxter wrote:
> I think it would be convenient if packages could be aliased.
>
> Right now this is not possible:
>
> alias tango.io tio; // this alias actually compiles, but...
> import tio.Stdout; // import using it doesn't work
>
> (Note for the Tango non-savvy: import tango.io.Stdout *is* valid.)
>
> So my proposal is simply to make the above code work.
> I was actually mildly surprised that it didn't.
After reading everyone's replies I think I am also somewhat ambivalent
about this proposal. Copy-paste is not hard with any half decent text
editor. And while long preambles full of redundant import statements
may look like a waste of space, it's not particularly hard to read
something like this:
import dwt.DWT;
import dwt.graphics.Color;
import dwt.graphics.Rectangle;
import dwt.graphics.GC;
import dwt.widgets.Display;
import dwt.widgets.Shell;
import dwt.widgets.Widget;
import dwt.widgets.Composite;
import dwt.widgets.Tree;
import dwt.widgets.TreeItem;
import dwt.widgets.Text;
import dwt.widgets.Listener;
import dwt.widgets.Event;
import dwt.layout.FillLayout;
import dwt.custom.TreeEditor;
Plus you can always make your own package subset public-import module if
you want.
--bb
More information about the Digitalmars-d
mailing list