the point of selective importing

Brad Roberts braddr at puremagic.com
Tue Jul 11 21:53:10 PDT 2006


Walter Bright wrote:
> John Reimer wrote:
>> Several dedicated people here are making these import suggestions 
>> based on lots
>> of time and experience putting D to use in large projects.  It becomes 
>> more
>> evident, in that context, why D is NOT the same as Java, C#, C++, and 
>> why it
>> shouldn't be the same, even in the context of namespaces. It's a complete
>> mistake to try to cast D in the same mold as those languages, whatever 
>> Walter
>> keeps saying.  D maintains a different aura and seems to invite a new 
>> style, all
>> evidence of a healthy evolution of a language.
> 
> It's easy to demonstrate the utility of feature X if it has a proven 
> track record in other languages. If it does not exist in those other 
> languages, the case for X must have a significantly higher bar to get over.

Perl's module importing supports subsetting of symbols.

use module;  -- imports everything in the module
use module(sym1,sym2); -- imports strictly sym1 and 2, and nothing else.

 From a maintainability standpoint, being able to easily and quickly 
deduce where a symbol comes from is invaluable.  More so when a language 
is highly dynamic as perl is, though it holds for all languages.

It's one of the things that bugs me about c and c++.. it's often a pain 
to discover where some symbol comes from without the use of grep or 
source indexers (lxr, cscope, c/etags, intellisense and its ilk).  This 
is one of the core aspects of this thread, imho, and it's not been 
explicitly pointed out (though I could have easily missed it amongst the 
avalanche of posts).

Later,
Brad



More information about the Digitalmars-d mailing list