On 2010-05-14 21:19:38 -0400, Alex Makhotin <[email protected]> said:

OK, 'static import' combination seems to force use of fully qualified name. Requires a lot of typing of the fully names for imported classes.
A lot of typing only for the sake of one global variable.

Instead of using 'static import' you can also do a *selective* import, like this:

        import Server.TestM1 : name;

Now, only the 'name' symbol is imported (and if there is no public 'name' symbol, you get an error). Isn't that what you want?

I do this all the time when importing symbols from modules not under my control. It's a good way to document what you're actually using, and it also prevents conflicts in the event the external module is updated.

But for modules which are tightly coupled together, importing specifically each and every name is quite tiresome and often pointless, so I do not specify the list of symbols.

I really like the way import works in D.


--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to