www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Extending imports with "*"

reply denisw <denisw_member pathlink.com> writes:
I think it should be possible to import all modules stored in a specific package
by one shot, like this:

import std.c.*; // Imports all modules in package std.c 
Mar 03 2005
next sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
denisw wrote:

 I think it should be possible to import all modules stored
 in a specific package by one shot, like this:
 
 import std.c.*; // Imports all modules in package std.c 
We all do, but meanwhile there's a few workarounds: http://www.prowiki.org/wiki4d/wiki.cgi?BestPractice #ConventionalModuleNameforImportingAllModulesinaPackage But we can still hope that D gets Java-style * imports. --anders
Mar 03 2005
next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Typo:
 http://www.prowiki.org/wiki4d/wiki.cgi?BestPractice
 #ConventionalModuleNameforImportingAllModulesinaPackage
http://www.prowiki.org/wiki4d/wiki.cgi?BestPractices #ConventionalModuleNameforImportingAllModulesinaPackage --anders
Mar 03 2005
prev sibling parent J C Calvarese <jcc7 cox.net> writes:
In article <d07cof$nl$2 digitaldaemon.com>,
=?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= says...
denisw wrote:

 I think it should be possible to import all modules stored
 in a specific package by one shot, like this:
 
 import std.c.*; // Imports all modules in package std.c 
We all do, but meanwhile there's a few workarounds: http://www.prowiki.org/wiki4d/wiki.cgi?BestPractice #ConventionalModuleNameforImportingAllModulesinaPackage But we can still hope that D gets Java-style * imports. --anders
I don't the issue is that Walter hasn't had time to add this feature. I think the issue is that Walter doesn't think it'd be a good idea to have this feature (the programmer might bring in modules that he didn't expect). FWIW, I think import * would create more trouble than it's worth. But we've already discussed this to death, so I'll leave it there. jcc7
Mar 03 2005
prev sibling next sibling parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
No bloody way!

This is one Java's most specious pieces of utility.

The only reason for it is laziness on the part of the (initial) 
programmer. The arguments against are legion: coupling, reduction in 
maintainability, intractable to automated dependency source analysis 
tools, etc. etc.

"denisw" <denisw_member pathlink.com> wrote in message 
news:d07cf3$lv$1 digitaldaemon.com...
I think it should be possible to import all modules stored in a 
specific package
 by one shot, like this:

 import std.c.*; // Imports all modules in package std.c

 
Mar 03 2005
prev sibling parent Norbert Nemec <Norbert Nemec-online.de> writes:
denisw schrieb:
 I think it should be possible to import all modules stored in a specific
package
 by one shot, like this:
 
 import std.c.*; // Imports all modules in package std.c 
Even though this is supported by Python, it is considered very bad style for serious projects. It is useful for quick-and-dirty programming or interactive work, but I don't think D is intended to be optimized for that in any way.
Mar 05 2005