XuGang

记录一个程序员的成长

 

D语言介绍(转)


整理了有关D语言的介绍,如下:

     (邵东好Blog):

简单地说,D语言是一门新的编程语言,包含了C++、C# 跟 Java的长处,补充了它们的不足。(我想名字的由来可能是比C语言进一步^_^)

D语言的作者 Walter Bright (就一个人哦,暴强!!!)是大名鼎鼎的Symantec C++ compiler的作者,所以这门语言还是值得期待的。
目前的版本是D 0.167,Sep 18, 2006. (关注中, 期待新版本...)

其主页上介绍的特性很多,在我看来,主要还是其垃圾回收机制:
与C++相比,D语言采用了垃圾回收机制(GC),将程序员从指针堆里解放出来;
与C#/Java相比,其垃圾回收机制不需要虚拟机,运行速度提高,依赖性降低;
是C/C++的高效性与JAVA的安全性之结合。

目前,d语言缺少像java或是.net 丰富的类库,社区也不够活跃,个人感觉这只是了解的人不多而已。就语言特性而言,应该是相当丰富的,由于开源社区有mono和gnu classpath,加之d编译器已经有gnu 版本,前途是不可估量的。Shawn Liu 也对swt 的移植说明了java项目移植的可能性  

链接  

 D语言与其他语言功能比较表:
http://www.digitalmars.com/d/comparison.html

Feature D C C++ C# Java
Garbage Collection Yes No No Yes Yes
Functions          
Function delegates Yes No No Yes No
Function overloading Yes No Yes Yes Yes
Out function parameters Yes Yes Yes Yes No
Nested functions Yes No No No No
Function literals Yes No No No No
Dynamic closures Yes No No No No
Arrays          
Lightweight arrays Yes Yes Yes No No
Resizeable arrays Yes No No No No
Arrays of bits Yes No No No No
Built-in strings Yes No No Yes Yes
Array slicing Yes No No No No
Array bounds checking Yes No No Yes Yes
Associative arrays Yes No No No No
Strong typedefs Yes No No No No
String switches Yes No No Yes No
Aliases Yes Yes Yes No No
OOP          
Object Oriented Yes No Yes Yes Yes
Multiple Inheritance No No Yes No No
Interfaces Yes No Yes Yes Yes
Operator overloading Yes No Yes Yes No
Modules Yes No Yes Yes Yes
Dynamic class loading No No No Yes Yes
Nested classes Yes Yes Yes Yes Yes
Inner (adaptor) classes No No No No Yes
Covariant return types Yes No Yes No No
Properties Yes No No Yes No
Performance          
Inline assembler Yes Yes Yes No No
Direct access to hardware Yes Yes Yes No No
Lightweight objects Yes Yes Yes Yes No
Explicit memory allocation control Yes Yes Yes No No
Independent of VM Yes Yes Yes No No
Direct native code gen Yes Yes Yes No No
Generic Programming          
Templates Yes No Yes No No
Mixins Yes No No No No
typeof Yes No No Yes No
foreach Yes No No Yes No
Constraints Yes No No No No
Reliability          
Contract Programming Yes No No No No
Unit testing Yes No No No No
Static construction order Yes No No Yes Yes
Guaranteed initialization Yes No No Yes Yes
RAII (automatic destructors) Yes No Yes Yes No
Exception handling Yes No Yes Yes Yes
try-catch-finally blocks Yes No No Yes Yes
Thread synchronization primitives Yes No No Yes Yes
Compatibility          
C-style syntax Yes Yes Yes Yes Yes
Enumerated types Yes Yes Yes Yes No
Support all C types Yes Yes No No No
80 bit floating point Yes Yes Yes No No
Complex and Imaginary Yes Yes No No No
Direct access to C Yes Yes Yes No No
Use existing debuggers Yes Yes Yes No No
Struct member alignment control Yes No No No No
Generates standard object files Yes Yes Yes No No
Macro text preprocessor No Yes Yes No No
Other          
Conditional compilation Yes Yes Yes Yes No
Unicode source text Yes Yes Yes Yes Yes

 

D语言主页:
http://www.minddrome.com/produtos/d/
http://www.digitalmars.com/d/


C#与C、C++、D、Java 的性能比较(中文)
http://mag.vchelp.net/200312/fanyi.htm


OSNews.com的介绍:
http://www.osnews.com/story.php?news_id=6761


D语言编译器下载:
http://www.digitalmars.com/d/dcompiler.html  

D语言安装及使用

下载dmd.zip/dmc.zip ,解压到磁盘目录,把dmd\bin和dm\bin追加到环境变量path中即可

使用dmd 编译d源代码,如

1. hello.d

void main(){
 printf("hello, world!");
}

2. dmd hello.d

3. hello

 



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1758230

posted on 2007-09-22 22:40  钢钢  阅读(2676)  评论(0编辑  收藏  举报

导航