import RFC

Rioshin an'Harthen rharth75 at hotmail.com
Tue Jul 11 11:03:40 PDT 2006


"Sean Kelly" <sean at f4.ca> wrote:
> As for the topic at hand, I feel that:
>
> * "static import" is better than what we have now, but I'm not terribly 
> keen on the need for an additional alias line to avoid FQS names (which I 
> expect to commonly be quite long).  I know it's just an additional line of 
> code, but this is a case where the need for an alias line may relegate the 
> entire feature to the realm of the Exceedingly Careful.
>
> * Some variation on the "as" syntax appears to be the best means of 
> achieving readability, easing maintenance, and encouraging the use of what 
> I feel is a good programming practice.  I also believe little things like 
> this are crucial in deciding whether a particular feature or technique 
> achieves common use.

I think the best keyword to use is "alias". It's already used for the same 
purpose, so would not be overloaded to mean something completely other. As 
for "as", "alias" in my opinion would be easier to remember, since we're 
using it already to alias the names.

So, for example, say that module.name.whatever contains a function foobar. 
Now (fuller in the "the point of selective importing" thread):

    static import module.name.whatever alias mnw;

allows to call foobar through module.name.whatever.foobar or mnw.foobar, 
meaning foobar could not clash with anything imported from another module, 
say if we import another.module, also defining a function foobar. 





More information about the Digitalmars-d mailing list