public import and bugs it causes

Walter Bright newshound1 at digitalmars.com
Fri May 14 20:54:45 PDT 2010


Leandro Lucarella wrote:
> Yes, that's exactly what Nick said in the mail I was replying, I just
> wanted to note that Nick was not right saying that not having import
> foo.*; is better because people say is a "bad practice" in Java. You can
> do better than hava and have the feature in a safe, useful way. Then, you
> might still like it or not. I guess you and Nick don't like; I do (even
> when I practically never use it, I like knowing it's there for the few
> quick & dirty stuff where is handy =P).

You're right in that I don't like it. It's just too sloppy for me. For example, 
if the user's directory is missing a file for whatever reason, you're not going 
to get a useful error message out of the compiler. The compiler cannot know that 
foo.bar is required for successful compilation with foo.*

And yes, having the wrong set of files in a directory, missing files, extra 
files, etc., is a very common problem, even for experienced programmers. I had 
that problem just the other day when I tried to do a compile on my laptop and 
discovered that my script to copy files to the laptop had errored out on a 
couple of them.


More information about the Digitalmars-d mailing list