Making D Lang More easy.

Mafi mafi at example.org
Wed May 11 09:26:11 PDT 2011


Am 11.05.2011 18:17, schrieb Jonathan M Davis:
> On 2011-05-11 07:22, Mafi wrote:
>> The module system has been given much attention so that the import order
>> doesn't matter and you cannot use an ambigous symbol without error.
>> Because there's no VM, you have to import everything you want to use.
>> If you know C++, think of it like #include and using namespace x; at the
>> same time.
>> http://d-programming-language.org/module.html#ImportDeclaration
>
> That's an odd comment to make. D's import is very similar to Java's import and
> is far more like Java's import than C/C++'s #include. D is probably pickier
> about possible name conflicts, but in general, importing in D and Java and
> pretty much the same. You're specifically importing _modules_ in D, and D
> doesn't enforce 1 public class per file, so the syntax is a bit different when
> importing specific classes rather than a whole module, and you do have to deal
> with the possibility of conflicting free functions whereas they aren't even
> legal in Java, but overall importing in Java and D and pretty similar. I don't
> know why you'd be comparing D's import to C/C++'s #include rather than Java's
> import.
>
> - Jonathan M Davis

(Note that I meant #including .h-files)
What I wanted to make absolutely clear is that you can't just say 
java.util.ArrayList without explicitely importing java.util in D. It is 
possible in Java but not in D.
Importing in Java is like 'using some_class;' in C++.


More information about the Digitalmars-d mailing list