March 03, 2005
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


March 03, 2005
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
March 03, 2005
Typo:
> http://www.prowiki.org/wiki4d/wiki.cgi?BestPractice
> #ConventionalModuleNameforImportingAllModulesinaPackage

http://www.prowiki.org/wiki4d/wiki.cgi?BestPractices
#ConventionalModuleNameforImportingAllModulesinaPackage

--anders
March 03, 2005
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
March 03, 2005
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
>
> 


March 05, 2005
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.

Top | Discussion index | About this forum | D home