www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - What are the reasons for this syntax??

reply Matthew Ong <ongbp yahoo.com> writes:
Hi ALL,

Refering to these 2 URL:
http://hg.dsource.org/projects/dwt2/file/d00e8db0a568/base/src/java/io/FileOutputStream.d

// why the public here?
6 public import java.io.File;
7 public import java.io.OutputStream;
9 import java.lang.all; // I can understand this here.

13} else { // Phobos
    // Why the import needed static?
14 static import std.file;
15 static import std.path;
16}

// What is the purpose of using alias here?
20 alias java.io.OutputStream.OutputStream.write write;
21 alias java.io.OutputStream.OutputStream.close close;


http://hg.dsource.org/projects/dwt2/file/d00e8db0a568/base/src/java/io/ByteArrayInputStream.d

8 alias java.io.InputStream.InputStream.read read;
9 alias java.io.InputStream.InputStream.skip skip;
10 alias java.io.InputStream.InputStream.available available;
11 alias java.io.InputStream.InputStream.close close;
12 alias java.io.InputStream.InputStream.mark mark;
13 alias java.io.InputStream.InputStream.reset reset;
14 alias java.io.InputStream.InputStream.markSupported markSupported;

Thanks very much.

-- 
Matthew Ong
email: ongbp yahoo.com
May 24 2011
parent David Nadlinger <see klickverbot.at> writes:
Hi Mathew,

I'm always happy to see people enthusiastic about D, but please keep in 
mind that posting the same question multiple times is generally 
considered impolite on newsgroups and mailing lists.

Furthermore, you were right about posting to dm.D.learn and not here, as 
the issues are clearly described in the docs:
http://www.digitalmars.com/d/2.0/module.html#ImportDeclaration
http://d-programming-language.org/hijack.html

David


On 5/24/11 12:59 PM, Matthew Ong wrote:
 Hi ALL,

 Refering to these 2 URL:
 http://hg.dsource.org/projects/dwt2/file/d00e8db0a568/base/src/java/io/FileOutputStream.d


 // why the public here?
 6 public import java.io.File;
 7 public import java.io.OutputStream;
 9 import java.lang.all; // I can understand this here.

 13} else { // Phobos
 // Why the import needed static?
 14 static import std.file;
 15 static import std.path;
 16}

 // What is the purpose of using alias here?
 20 alias java.io.OutputStream.OutputStream.write write;
 21 alias java.io.OutputStream.OutputStream.close close;


 http://hg.dsource.org/projects/dwt2/file/d00e8db0a568/base/src/java/io/ByteArrayInputStream.d


 8 alias java.io.InputStream.InputStream.read read;
 9 alias java.io.InputStream.InputStream.skip skip;
 10 alias java.io.InputStream.InputStream.available available;
 11 alias java.io.InputStream.InputStream.close close;
 12 alias java.io.InputStream.InputStream.mark mark;
 13 alias java.io.InputStream.InputStream.reset reset;
 14 alias java.io.InputStream.InputStream.markSupported markSupported;

 Thanks very much.

May 24 2011