{"id":163058,"date":"2019-12-01T12:27:48","date_gmt":"2019-12-01T04:27:48","guid":{"rendered":"https:\/\/gulass.cn\/?p=163058"},"modified":"2019-11-04T09:28:41","modified_gmt":"2019-11-04T01:28:41","slug":"basic-part-d-language","status":"publish","type":"post","link":"https:\/\/gulass.cn\/basic-part-d-language.html","title":{"rendered":"D\u7f16\u7a0b\u8bed\u8a00\u57fa\u7840\u7bc7"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nD \u8bed\u8a00\u66fe\u7ecf\u5174\u76db\u8fc7\uff0c\u4e5f\u968f\u7740\u4fe1\u606f\u6280\u672f\u53d1\u5c55\u800c\u9893\u5e9f\u8fc7\uff0c\u4f46\u6700\u7ec8\u6211\u4eec\u5f88\u9ad8\u5174\u7684\u770b\u5230\u5b83\u53c8\u5e26\u7740\u5f3a\u70c8\u7684\u81ea\u4fe1\u5f00\u59cb\u590d\u82cf\uff0c\u5e0c\u671b\u901a\u8fc7\u672c\u6587\u8ba9\u73b0\u4ee3\u8ba1\u7b97\u673a\u79d1\u5b66\u5de5\u4f5c\u8005\u8fdb\u4e00\u6b65\u4e86\u89e3\u8fd9\u95e8\u5177\u6709\u72ec\u7279\u9b45\u529b\u7684\u7f16\u7a0b\u8bed\u8a00\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u5f15\u8a00<\/strong><\/strong><\/div>\n

D \u8bed\u8a00\u662f\u4e00\u95e8\u8bed\u6cd5\u76f8\u5f53\u4f18\u96c5\u7684\u7f16\u8bd1\u578b\u8bed\u8a00\uff0c\u81ea 1999 \u5e74\u53d1\u5e03\u81f3\u4eca\u5df2\u53d1\u5c55\u4e86 20 \u5e74\uff0c\u5b83\u65e2\u62e5\u6709 Java \u90a3\u6837\u5f3a\u5927\u7684\u8868\u73b0\u529b\uff0c\u53c8\u5177\u6709 C++ \u76f8\u5f53\u7684\u6027\u80fd\uff0c\u672c\u6765\u662f\u4e00\u95e8\u672a\u6765\u76f8\u5f53\u660e\u6717\u7684\u8bed\u8a00\uff0c\u4f46\u662f\u5f53\u5e74\u56e0\u4e3a 2.x \u7248\u672c\u7834\u574f\u6027\u5347\u7ea7\u5bfc\u81f4\u793e\u533a\u5927\u91cf\u6838\u5fc3\u5f00\u53d1\u8005\u5c06\u5176\u653e\u5f03\u3002
\n2010 \u5e74<\/strong>\uff0c\u4f34\u968f\u7740 Andrei Alexandrescu \u65b0\u4e66\u300aThe D Programming Language\u300b\u7684\u51fa\u7248\uff0cD \u8bed\u8a00\u53c8\u53d8\u5f97\u6d3b\u8dc3\u8d77\u6765\uff0cD \u8bed\u8a00 2.0 \u7684\u7279\u6027\u53d8\u5f97\u7a33\u5b9a\uff0c\u8fd0\u884c\u5e93\u4e0e\u6807\u51c6\u5e93\u7684\u5206\u79bb\uff0c\u89e3\u51b3\u4e86 D \u8bed\u8a00 1.0 \u65f6\u671f\u6807\u51c6\u5e93\u4e4b\u4e89\u7684\u95ee\u9898\u3002
\n2011<\/strong>\u00a0\u5e74<\/strong>\uff0cD \u8bed\u8a00\u7684\u5f00\u53d1\u8fc1\u79fb\u5230\u4e86 Github\uff0c\u5728\u6709\u4e86\u66f4\u597d\u7684\u4ee3\u7801\u7ba1\u7406\u548c bug \u8ddf\u8e2a\u65b9\u5f0f\u4e4b\u540e\uff0c\u53c2\u4e0e\u5230 D \u8bed\u8a00\u7f16\u8bd1\u5668\u3001\u8fd0\u884c\u5e93\u548c\u6807\u51c6\u5e93\u5f00\u53d1\u7684\u4eba\u5458\u4e5f\u6709\u4e86\u660e\u663e\u7684\u589e\u52a0\u3002\u6b21\u5e74\uff0cD \u8bed\u8a00 1.0 \u7248\u672c\u505c\u6b62\u66f4\u65b0\uff0c\u5f00\u53d1\u8005\u5168\u529b\u6295\u5165\u5230 2.0 \u7684\u5f00\u53d1\u3002
\n2014\u00a0<\/strong>\u5e74<\/strong>\uff0cD \u8bed\u8a00\u7f16\u8bd1\u5668\u524d\u7aef\u4ee3\u7801\u7684\u8bb8\u53ef\u534f\u8bae\u53d8\u66f4\u4e3a\u66f4\u52a0\u5bbd\u677e\u7684 Boost \u8bb8\u53ef\u3002\u5728 2017 \u5e74\uff0c\u7f16\u8bd1\u5668\u6240\u6709\u4ee3\u7801\u6700\u7ec8\u90fd\u4f7f\u7528\u4e86 Boost \u8bb8\u53ef\u3002\u5728\u89e3\u51b3\u7f16\u8bd1\u5668\u6e90\u7801\u8bb8\u53ef\u95ee\u9898\u4e4b\u540e\uff0cD \u8bed\u8a00\u5728\u5f00\u6e90\u793e\u533a\u4e2d\u53d8\u5f97\u66f4\u52a0\u5f00\u653e\uff0c\u5e76\u987a\u5229\u5408\u5e76\u8fdb\u5165\u4e86 GCC 9.x\u3002
\n\u76f4\u5230\u00a02015\u00a0<\/strong>\u5e74<\/strong>\uff0cD \u8bed\u8a00\u793e\u533a\u8fdb\u4e00\u6b65\u6062\u590d\u6d3b\u529b\uff0c\u57fa\u4e8e\u5305\u7ba1\u7406\u7684\u6784\u5efa\u65b9\u5f0f\u5f00\u59cb\u6210\u719f\uff0c\u5927\u91cf\u7684\u5f00\u53d1\u5e93\u5f00\u59cb\u6d8c\u73b0\u5e76\u5e94\u7528\u5230\u5b9e\u9645\u9879\u76ee\u4e2d\u3002\u76ee\u524d\uff0c\u5df2\u6ce8\u518c\u9879\u76ee\u5e93\u8fbe 1 \u5343 6 \u767e\u591a\u4e2a\u3002
\n\"\"
\n\u91cd\u65b0\u71c3\u8d77\u5e0c\u671b\u7684 D \u8bed\u8a00\u5728\u7248\u672c\u53d1\u5e03\u7684\u89c4\u5212\u4e0a\u975e\u5e38\u7a33\u5065\uff0c\u76f4\u81f3\u4eca\u65e5\u6765\u8bf4\u6bcf\u4e24\u4e2a\u6708\u90fd\u53ef\u4ee5\u4fdd\u8bc1\u4e00\u4e2a\u5927\u7248\u672c\u7684\u53d1\u5e03\u3002\u5e73\u5747\u6bcf\u4e2a\u7248\u672c\u7684\u5f00\u53d1\u8005\u6570\u91cf\u90fd\u6709\u8d85\u8fc7 50 \u4e2a\u6838\u5fc3\u8d21\u732e\u8005\uff0c\u6700\u8fd1\u7684 2.087.0 \u66f4\u662f\u8fbe\u5230\u4e86 62 \u4f4d\u6838\u5fc3\u5f00\u53d1\u8005\u7684\u8d21\u732e\u3002
\n\u7f16\u7a0b\u8bed\u8a00\u7684\u6218\u4e89\u5f02\u5e38\u60e8\u70c8\uff0c\u672c\u6587\u5e0c\u671b\u901a\u8fc7\u4ecb\u7ecd\uff0c\u8ba9\u5f00\u53d1\u8005\u91cd\u65b0\u6765\u4e86\u89e3\u4e00\u4e0b D \u8bed\u8a00\uff0c\u8ba4\u8bc6\u5230 D \u8bed\u8a00\u5176\u5b9e\u662f\u4e00\u95e8\u80fd\u529b\u5f3a\u5927\u7684\u8bed\u8a00\uff0c\u5e76\u4e14\u5b83\u53ef\u4ee5\u7528\u4e8e\u4e0d\u540c\u7684\u573a\u666f\uff0c\u751f\u6001\u4e5f\u5728\u4e0d\u65ad\u53d1\u5c55\u5b8c\u5584\u4e2d\u3002<\/p>\n

\u7b2c\u4e00\u90e8\u5206\uff1aD \u8bed\u8a00\u4e3b\u8981\u7279\u70b9<\/strong><\/strong><\/div>\n

D \u8bed\u8a00\u662f\u5728\u5438\u53d6 C++ \u9047\u5230\u7684\u5404\u79cd\u6559\u8bad\u57fa\u7840\u4e0a\u8bbe\u8ba1\u51fa\u6765\u7684\uff0c\u62e5\u6709\u4e0e\u4e4b\u7c7b\u4f3c\u7684\u7f16\u7a0b\u98ce\u683c\uff0c\u8bb8\u591a\u6982\u5ff5\u4e0e C \u6216 C++ \u90fd\u662f\u76f8\u901a\u7684\u3002\u4e0d\u8fc7\uff0cD \u8bed\u8a00\u4e5f\u6709\u81ea\u5df1\u7684\u4e00\u4e9b\u7279\u70b9\uff0c\u5982\u652f\u6301\u95ed\u5305\u3001\u533f\u540d\u51fd\u6570\u3001\u7f16\u8bd1\u65f6\u51fd\u6570\u6267\u884c\u3001\u652f\u6301\u5783\u573e\u56de\u6536\u7b49\u3002\u5177\u4f53\u6765\u8bb2\uff0cD \u8bed\u8a00\u62e5\u6709\u4ee5\u4e0b\u51e0\u4e2a\u4e3b\u8981\u7279\u70b9\uff1a<\/p>\n

\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b<\/strong><\/strong><\/span><\/div>\n

D \u8bed\u8a00\u5141\u8bb8\u5b9a\u4e49\u7c7b\u548c\u63a5\u53e3\u3002\u50cf Java \u4e00\u6837\uff0cD \u8bed\u8a00\u7684\u7ee7\u627f\u6a21\u578b\u662f\u5355\u7c7b\u7ee7\u627f\u548c\u591a\u63a5\u53e3\u7ee7\u627f\u3002\u6240\u6709\u7684\u7c7b\u90fd\u6709\u4e00\u4e2a\u6839\u7c7b Object\u3002D \u8bed\u8a00\u7684\u7c7b\u548c\u63a5\u53e3\u90fd\u662f\u5f15\u7528\u7c7b\u578b\uff0c\u800c\u7ed3\u6784\u662f\u503c\u7c7b\u578b\uff0c\u4e14\u4e0d\u5141\u8bb8\u7ee7\u627f\u3002<\/p>\n

\u51fd\u6570\u5f0f\u7f16\u7a0b<\/strong><\/strong><\/span><\/div>\n

D \u8bed\u8a00\u50cf C++ \u4e00\u6837\uff0c\u5141\u8bb8\u5728\u7c7b\u6216\u7ed3\u6784\u5916\u5355\u72ec\u5b9a\u4e49\u51fd\u6570\u3002\u5b83\u8fd8\u63d0\u4f9b\u4e86\u5404\u79cd\u4e0d\u53ef\u53d8\u6570\u636e\u7c7b\u578b\u3001\u533f\u540d\u51fd\u6570\u548c\u95ed\u5305\u3001UFCS\uff08\u7edf\u4e00\u51fd\u6570\u8c03\u7528\u8bed\u6cd5\uff09\u7b49\u7279\u6027\u6765\u66f4\u597d\u5730\u652f\u6301\u51fd\u6570\u5f0f\u7f16\u7a0b\u3002<\/p>\n

\u6cdb\u578b\u7f16\u7a0b<\/strong><\/strong><\/span><\/div>\n

D \u8bed\u8a00\u5141\u8bb8\u5b9a\u4e49\u6a21\u578b\u7c7b\u578b\uff0c\u4e5f\u652f\u6301\u76f4\u63a5\u5b9a\u4e49\u6a21\u677f\u7c7b\u548c\u6a21\u677f\u51fd\u6570\u3002\u6a21\u677f\u5141\u8bb8\u5d4c\u5957\u5b9a\u4e49\uff0c\u6a21\u677f\u65b9\u6cd5\u751a\u81f3\u5141\u8bb8\u9012\u5f52\u8c03\u7528\u3002\u901a\u8fc7\u6a21\u677f\u7ea6\u675f\u53ef\u4ee5\u5b9e\u73b0\u6a21\u677f\u7c7b\u578b\u91cd\u8f7d\u3002\u6a21\u677f\u53c2\u6570\u652f\u6301\u4e0d\u5b9a\u4e2a\u6570\u7c7b\u578b\u3002\u9664\u6b64\u4ee5\u5916\uff0c\u6a21\u677f\u53c2\u6570\u7c7b\u578b\u8fd8\u652f\u6301\u81ea\u52a8\u63a8\u5bfc\u3002<\/p>\n

\u5143\u7f16\u7a0b<\/strong><\/strong><\/span><\/div>\n

D \u8bed\u8a00\u91cc\u7684\u7eaf\u51fd\u6570\u4e0d\u4f1a\u5bf9\u5168\u5c40\u53d8\u91cf\u4ea7\u751f\u4efb\u4f55\u5f71\u54cd\uff0c\u56e0\u6b64\u53ef\u4ee5\u5728\u7f16\u8bd1\u65f6\u76f4\u63a5\u8c03\u7528\u3002\u501f\u52a9 static if\u3001static foreach\u3001mixin \u7b49\u8bed\u53e5\uff0c\u53ef\u4ee5\u7f16\u5199\u5728\u7f16\u8bd1\u65f6\u6267\u884c\u7684\u4ee3\u7801\uff0c\u52a8\u6001\u751f\u6210\u4ee3\u7801\uff0c\u6ee1\u8db3\u5feb\u901f\u5b9a\u5236\u5e94\u7528\u529f\u80fd\u7684\u9700\u6c42\u3002<\/p>\n

\u5b89\u5168\u5185\u5b58<\/strong><\/strong><\/span><\/div>\n

\u9ed8\u8ba4\u652f\u6301\u57fa\u4e8e\u5783\u573e\u56de\u6536\u7684\u5185\u5b58\u7ba1\u7406\u65b9\u5f0f\uff0c\u4ece\u800c\u8ba9\u7f16\u7a0b\u53d8\u5f97\u66f4\u7b80\u5355\uff0c\u5185\u5b58\u53d8\u5f97\u5b89\u5168\uff0c\u7a0b\u5e8f\u53d8\u5f97\u66f4\u7a33\u5b9a\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u4e5f\u53ef\u4ee5\u6839\u636e\u9700\u8981\u5bf9\u5173\u952e\u7684\u5185\u5b58\u8d44\u6e90\u9009\u62e9\u624b\u52a8\u7ba1\u7406\u65b9\u5f0f\u3002\u501f\u52a9 scope \u8bed\u53e5\uff0c\u53ef\u4ee5\u5f88\u597d\u5730\u63a7\u5236\u5185\u5b58\u8d44\u6e90\u7533\u8bf7\u548c\u91ca\u653e\u70b9\u3002D \u8bed\u8a00\u5185\u90e8\u6709\u4e00\u5957\u6838\u5fc3\u7684\u7c7b\u578b\u5b9a\u4e49\u548c\u5b9e\u73b0\uff0c\u5b83\u662f D \u8bed\u8a00\u7684\u4e00\u4e2a\u5b50\u96c6\uff0c\u4e5f\u88ab\u79f0\u4f5c SafeD\uff0c\u7528\u4e8e\u4fdd\u62a4\u5185\u5b58\u7684\u5b89\u5168\u3002<\/p>\n

\u6a21\u5757\u5316\u7f16\u7a0b<\/strong><\/strong><\/span><\/div>\n

D \u8bed\u8a00\u7684\u6bcf\u4e00\u4e2a\u6e90\u6587\u4ef6\u90fd\u88ab\u5b9a\u4e49\u4e3a\u4e00\u4e2a\u6a21\u5757(module)\uff0c\u6e90\u6587\u4ef6\u4e4b\u95f4\u7684\u4f9d\u8d56\u5373\u4f53\u73b0\u4e86\u6a21\u5757\u4e4b\u95f4\u7684\u4f9d\u8d56\u3002\u540c\u4e00\u76ee\u5f55\u4e0b\u7684\u591a\u4e2a\u6a21\u5757\u53ef\u4ee5\u7ec4\u6210\u4e00\u4e2a\u5305(package)\u3002\u57fa\u4e8e\u6a21\u5757\u7684\u4ee3\u7801\u8ba9\u9879\u76ee\u7684\u903b\u8f91\u53d8\u5f97\u66f4\u52a0\u6e05\u6670\uff0c\u4e5f\u4e3a\u9879\u76ee\u7684\u5feb\u901f\u6784\u5efa\u548c\u7f16\u8bd1\u63d0\u4f9b\u4e86\u652f\u6301\u3002<\/p>\n

\u5176\u4ed6\u8bed\u8a00\u4ea4\u4e92<\/strong><\/strong><\/span><\/div>\n

D\u8bed\u8a00\u7684ABI\u4e0eC\u8bed\u8a00\u5b8c\u5168\u517c\u5bb9\uff0c\u56e0\u6b64\u5b83\u4e5f\u5177\u6709\u5f88\u597d\u7684\u4e0e\u5176\u4ed6\u8bed\u8a00\u4ea4\u4e92\u7684\u80fd\u529b\uff0c\u5982\u4e0e C\u3001C++ \u548c Objective-C \u7b49\u8bed\u8a00\u8fdb\u884c\u4ea4\u4e92\u7f16\u7a0b\u3002D \u8bed\u8a00\u751a\u81f3\u652f\u6301\u76f4\u63a5\u5d4c\u5165\u6c47\u7f16\u8bed\u8a00\uff0c\u90e8\u5206\u6027\u80fd\u5173\u952e\u7684\u4ee3\u7801\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u6c47\u7f16\u8bed\u8a00\u6765\u5b9e\u73b0\u3002D \u8bed\u8a00\u7684 BetterC \u7279\u6027\u662f D \u8bed\u8a00\u7684\u4e00\u4e2a\u5b50\u96c6\uff0c\u80fd\u5b8c\u5168\u53bb\u9664 GC \u4f9d\u8d56\uff0c\u5e76\u4ee5\u66f4\u597d C \u8bed\u8a00\u7684\u65b9\u5f0f\u6765\u4ee3\u66ff C \u8bed\u8a00\u7f16\u7a0b\uff0c\u5b83\u80fd\u80dc\u4efb C \u8bed\u8a00\u505a\u7684\u7edd\u5927\u90e8\u5206\u5de5\u4f5c\u3002\u5728 Windows \u5e73\u53f0\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528 COM \u63a5\u53e3\u5b9e\u73b0\u4e0e\u5176\u4ed6\u8bed\u8a00\u7684\u4ea4\u4e92\u3002<\/p>\n

\u57fa\u4e8e\u5305\u7684\u5e94\u7528\u6784\u5efa<\/strong><\/strong><\/span><\/div>\n

\u8fd9\u4e2a\u4e0d\u5c5e\u4e8e D \u8bed\u8a00\u672c\u8eab\u7279\u6027\uff0c\u4f46\u662f\u5728 D \u8bed\u8a00\u7684\u5f00\u53d1\u751f\u6001\u91cc\uff0c\u8fd9\u662f\u4e00\u79cd\u5f88\u975e\u5e38\u91cd\u8981\u548c\u4fbf\u6377\u7684 D \u8bed\u8a00\u5e94\u7528\u6784\u5efa\u65b9\u5f0f\u3002dub \u662f D \u8bed\u8a00\u7684\u5e94\u7528\u6784\u5efa\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u5f88\u597d\u5730\u7ba1\u7406\u5e94\u7528\u5305\u4e4b\u95f4\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u5feb\u901f\u5730\u6784\u5efa\u51fa D \u8bed\u8a00\u5e94\u7528\u3002
\n\u9664\u4e86\u4e0a\u8ff0\u7279\u70b9\uff0cD \u8bed\u8a00\u8fd8\u63d0\u4f9b\u4e86\u8bb8\u591a\u5176\u4ed6\u7279\u6027\uff0c\u5982\u5185\u5efa\u5173\u8054\u6570\u7ec4\u3001\u5355\u5143\u6d4b\u8bd5\u3001\u5185\u8054\u6c47\u7f16\u3001\u5185\u5d4c\u6587\u6863\u7b49\uff0c\u8fd9\u4e9b\u7279\u6027\u8ba9 D \u8bed\u8a00\u6210\u4e3a\u4e86\u4e00\u95e8\u529f\u80fd\u5f3a\u5927\u7684\u8bed\u8a00\u3002<\/p>\n

\u7b2c\u4e8c\u90e8\u5206\uff1a\u4e0e\u5176\u5b83\u8bed\u8a00\u7684\u7b80\u8981\u5bf9\u6bd4<\/strong><\/strong><\/div>\n
D \u8bed\u8a00\u4e0e Java \u76f8\u6bd4<\/strong><\/strong><\/span><\/div>\n

\u4f17\u6240\u5468\u77e5 Java \u5bf9\u5de5\u4e1a\u5316\u67b6\u6784\u7684\u8bbe\u8ba1\u975e\u5e38\u68d2\uff0c\u8fdc\u8d85\u8d8a C++\u3001Golang \u7b49\u8bed\u8a00\uff0c\u80fd\u4e0e Java \u76f8\u63d0\u5e76\u8bba\u7684\u53ea\u6709 C#\uff0c\u5728\u7814\u7a76\u4e2d\u6211\u4eec\u53d1\u73b0 D \u540c\u6837\u5177\u5907\u5de5\u4e1a\u5316\u7684\u7279\u6027\uff0c\u800c\u4e14\u4e0d\u9700\u8981\u90a3\u4e48\u5e9e\u6742\u7684\u865a\u62df\u673a\u5f00\u53d1\u73af\u5883\uff0cD \u7684\u6027\u80fd\u6bd4\u8d77 Java \u6765\u8bf4\u597d\u7684\u975e\u5e38\u660e\u663e\uff0c\u800c\u4e14\u6574\u5408 C\u3001C++ \u5e93\u7684\u65f6\u5019\u4e5f\u975e\u5e38\u65b9\u4fbf\uff0c\u800c Java \u60f3\u6574\u5408 C\u3001C++ \u5c31\u9700\u8981\u975e\u5e38\u9ebb\u70e6\u7684 jni \u5bf9\u53bb\u63a5\u3002\u6bd5\u7adf D \u8bed\u8a00\u662f\u540d\u526f\u5176\u5b9e\u7684\u7cfb\u7edf\u7ea7\u5f00\u53d1\u8bed\u8a00\uff0cD \u8bed\u8a00\u5728\u9762\u5411\u5bf9\u8c61\u65b9\u9762\u5e76\u4e0d\u50cf Java \u90a3\u6837\u5f3a\u5236\u6bcf\u4e2a\u6587\u4ef6\u90fd\u662f\u5bf9\u8c61\uff0c\u800c\u66f4\u50cf C++ \u90a3\u6837\u62e5\u6709\u4e00\u4e2a main() \u51fd\u6570\u4f5c\u4e3a\u7a0b\u5e8f\u5165\u53e3\u3002
\n\u793a\u4f8b\u4ee3\u7801<\/p>\n

import std.stdio;  \r\nvoid main()  \r\n{  \r\n    writeln(\"Hello world!\");  \r\n} \r\n<\/pre>\n
D \u8bed\u8a00\u4e0e C++ \u76f8\u6bd4<\/strong><\/strong><\/span><\/div>\n

\u8bf4\u5230\u6027\u80fd\uff0cC++ \u4e00\u76f4\u5360\u636e\u670d\u52a1\u7aef\u9ad8\u6027\u80fd\u7684\u9996\u9009\uff0c\u4f46\u662f D \u7684\u6027\u80fd\u4e0e C++ \u76f8\u6bd4\u51e0\u4e4e\u6253\u6210\u5e73\u624b\uff0c\u4f46\u6548\u7387\u53ef\u4ee5 3~5 \u500d\u4e8e C++\u3002\u5f53\u7136 D \u4e0e C \u8bed\u8a00\u5404\u79cd\u5e93\u6574\u5408\u540c\u6837\u65b9\u4fbf\uff0c\u56e0\u4e3a D \u8bed\u8a00\u662f\u4e8c\u8fdb\u5236\u4e0e C\u3001C++ \u517c\u5bb9\u7684\uff0c\u8bed\u6cd5\u66f4\u50cf\u662f C++ \u7684\u8d85\u7ea7\u5347\u7ea7\u7248\uff0cD \u5728\u5bf9 hashMap \u64cd\u4f5c\u65f6\u6027\u80fd\u6bd4 C++ \u8fd8\u8981\u9ad8\uff0c\u800c\u4e14\u53ea\u8981\u662f\u638c\u63e1 C++ \u7684\u4eba\u53ef\u4ee5\u6ca1\u6709\u4efb\u4f55\u95e8\u69db\u5730\u4f7f\u7528 D \u8bed\u8a00\u3002
\n\u793a\u4f8b\u4ee3\u7801<\/p>\n

import std.stdio;  \r\nvoid main()  \r\n{  \r\n    foreach(i; 1..10)  \r\n    {  \r\n        writeln(i);  \r\n    }  \r\n} \r\n<\/pre>\n
D \u8bed\u8a00\u4e0e PHP \u76f8\u6bd4<\/strong><\/strong><\/span><\/div>\n

PHP \u662f\u670d\u52a1\u7aef\u811a\u672c\u8bed\u8a00\u5360\u6709\u7387\u6700\u9ad8\u7684\u8bed\u8a00\uff0cPHP \u7684\u4f18\u52bf\u5c31\u662f\u7b80\u5355\uff0c\u65e0\u9700\u5f15\u5165\u4ec0\u4e48\u5305\u5c31\u53ef\u4ee5\u4f7f\u7528\u8bed\u8a00\u672c\u8eab\u7684\u6240\u6709\u51fd\u6570\uff0c\u4f46\u662f\u4e5f\u5c31\u662f\u8fd9\u6837 PHP \u7684\u6027\u80fd\u4e00\u76f4\u6ca1\u6709\u660e\u663e\u6539\u8fdb\uff0c\u867d\u7136\u8bf4 PHP 7.x \u7684\u51fa\u73b0\u8ba9 PHP \u7684\u6027\u80fd\u63d0\u5347\u4e86 2.x \u500d\uff0c\u4f46\u662f\u90a3\u53ea\u662f\u548c\u975e\u5e38\u6162\u7684 PHP 5.x \u76f8\u6bd4\u800c\u5df2\uff0c\u4e0e\u7f16\u8bd1\u578b\u8bed\u8a00\u76f8\u6bd4\u8fd8\u662f\u76f8\u5dee\u592a\u591a\u3002PHP \u6709\u975e\u5e38\u660e\u663e\u7684\u77ed\u677f\uff0c\u6bd4\u5982\u4e0d\u652f\u6301\u591a\u7ebf\u7a0b\u3001\u957f\u8fde\u63a5\u4e0d\u53cb\u597d\u3001\u5f31\u7c7b\u578b\u3001\u8de8\u8bed\u8a00 RPC \u534f\u8bae\u652f\u6301\u4e0d\u7a33\u5b9a\u3001\u90e8\u7f72\u9700\u8981 PHP \u8fd0\u884c\u73af\u5883\u7b49\uff0c\u800c D \u8bed\u8a00\u5177\u5907 C++ \u53ef\u5b9e\u73b0\u7684\u6240\u6709\u529f\u80fd\uff0c\u5305\u62ec\u5185\u5d4c\u6c47\u7f16\uff0c\u5f00\u53d1\u6548\u7387\u4e0a\u6765\u8bb2\u4e0e PHP \u76f8\u6bd4\u53ea\u662f\u591a\u4e86\u4e2a\u5f3a\u7c7b\u578b\u7684\u6982\u5ff5\uff0c\u800c D \u8bed\u8a00\u6807\u51c6\u5e93\u4e5f\u63d0\u4f9b to \u65b9\u6cd5\u8ba9\u4f60\u975e\u5e38\u65b9\u4fbf\u5730\u8fdb\u884c\u5404\u79cd\u7c7b\u578b\u7684\u8f6c\u6362\u3002
\n\u793a\u4f8b\u4ee3\u7801<\/p>\n

import std.stdio : writeln;  \r\nimport std.conv : to;\u00a0  \r\nvoid main()  \r\n{  \r\n    int i = 10000;  \r\n    string s = \"Is string \";  \r\n    s ~= i.to!string;    \/\/ PHP \u4f7f\u7528\u70b9\u8fde\u63a5\u4e24\u4e2a\u5b57\u7b26\u4e32\uff0c\u800c D \u8bed\u8a00\u4f7f\u7528\u6ce2\u6d6a\u7ebf\u8fde\u63a5\u4e24\u4e2a\u5b57\u7b26\u4e32  \r\n    writeln(s);    \/\/ \u8f93\u51fa\u7ed3\u679c Is string 10000  \r\n} \r\n<\/pre>\n
D \u8bed\u8a00\u53ef\u66ff\u4ee3 C \u8bed\u8a00<\/strong><\/strong><\/span><\/div>\n

\u524d\u9635\u5b50\u6709\u4e00\u7bc7\u6587\u7ae0\u6bd4\u8f83\u706b\uff0c\u6709\u4e00\u4f4d i3 \u6838\u5fc3\u5f00\u53d1\u8005\u5728\u6587\u7ae0\u4e2d\u8bf4\u5230\uff0cD \u624d\u662f\u771f\u6b63\u66ff\u4ee3 C \u7684\u9996\u9009\u8bed\u8a00\uff0c\u4ed6\u8ba4\u4e3a D \u4e8c\u8fdb\u5236\u4e0e C\u3001C++ \u5b8c\u5168\u517c\u5bb9\u6240\u4ee5\u53ef\u76f4\u63a5\u4f7f\u7528\u8fd9\u4e24\u4e2a\u8bed\u8a00\u7684\u4e8c\u8fdb\u5236\u5e93\uff0cD \u751a\u81f3\u53ef\u4ee5\u7528 dpp \u9879\u76ee\u76f4\u63a5 #include \u8bed\u6cd5\u5f15\u5165 *.h \u6587\u4ef6\uff0c\u4f5c\u8005\u540c\u65f6\u4e5f\u8bf4\u5230\u4e3a\u4ec0\u4e48 C \u7684\u66ff\u4ee3\u8005\u4e0d\u662f Rust \u548c Golang\uff0c\u6709\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u81ea\u884c\u4e86\u89e3\u539f\u6587\u300aD as a C Replacement\u300b\u3002
\n\"\"<\/p>\n

gcc \u6574\u5408 D \u8bed\u8a00\u7f16\u8bd1\u652f\u6301<\/strong><\/strong><\/span><\/div>\n

\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u5927\u7684\u8fdb\u6b65\uff0c\u5728\u8fd1\u671f\u53d1\u5e03\u7684 gcc 9.1 \u5927\u7248\u672c\u4e2d\u6574\u5408\u4e86 DLang \u5168\u65b0\u7684\u7f16\u8bd1\u5668\u524d\u7aef\u4e5f\u5c31\u662f gdc\uff0c\u73b0\u5728\u6574\u4e2a\u793e\u533a\u6709\u66f4\u591a\u5f00\u53d1\u8005\u5bf9 D \u9879\u76ee\u8fdb\u884c\u63a8\u8fdb\uff0c\u4e5f\u6709\u66f4\u591a\u4eba\u5728\u4f7f\u7528 D \u5b8c\u6210\u4e4b\u524d C\/C++ \u7684\u5de5\u4f5c\u3002<\/p>\n

\u7b2c\u4e09\u90e8\u5206\uff1aD \u8bed\u8a00\u4e3b\u8981\u5e94\u7528<\/strong><\/strong><\/div>\n

\u4f5c\u4e3a\u4e00\u95e8\u652f\u6301 GC \u7684\u7cfb\u7edf\u8bed\u8a00\uff0cD \u8bed\u8a00\u5df2\u88ab\u8bb8\u591a\u516c\u53f8\u91c7\u7eb3\u548c\u5e94\u7528\uff0c\u5176\u4e2d\u4e0d\u4e4f\u50cf Facebook\u3001eBay \u8fd9\u6837\u7684\u5927\u516c\u53f8\u3002D \u7684\u5e94\u7528\u6d89\u53ca\u4e86\u6e38\u620f\u3001Web \u5e94\u7528\u3001GUI \u5e94\u7528\u3001\u64cd\u4f5c\u7cfb\u7edf\u3001\u7f16\u8bd1\u5668\u3001\u5d4c\u5165\u5f0f\u3001\u79d1\u5b66\u8ba1\u7b97\u4e0e\u6559\u80b2\u7b49\u591a\u4e2a\u9886\u57df\u3002<\/p>\n

\u6e38\u620f\u5f00\u53d1<\/strong><\/strong><\/span><\/div>\n

Remedy \u516c\u53f8\u5df2\u6210\u529f\u5730\u7528 D \u8bed\u8a00\u5c06\u4e00\u6b3e 3A \u6e38\u620f Quantum Break \u79fb\u690d\u5230\u4e86 XBox One \u548c Windows 10 \u5e73\u53f0\u3002\u53e6\u5916\uff0c\u6709\u7eaf D \u8bed\u8a00\u5b9e\u73b0\u7684 3D \u6e38\u620f\u5f15\u64ce Dash \u548c D \u8bed\u8a00\u6e38\u620f\u5f00\u53d1\u5de5\u5177\u5e93 gfm\u3002<\/p>\n

Web \u6846\u67b6<\/strong><\/strong><\/span><\/div>\n

\u7f16\u7a0b\u8bed\u8a00\u5728 Web \u670d\u52a1\u7aef\u6846\u67b6\u975e\u5e38\u91cd\u8981\uff0c\u6709\u597d\u7528\u7684\u6846\u67b6\u53ef\u4ee5\u8ba9\u6574\u4e2a\u8bed\u8a00\u5145\u6ee1\u6d3b\u529b\uff0c\u5c31\u50cf Java \u6709\u4e00\u4e2a Spring Framework \u6846\u67b6\uff0cPHP \u6709\u4e00\u4e2a laravel \u6846\u67b6\uff0cPython \u62e5\u6709\u4e00\u4e2a Django\uff0c\u800c Ruby \u62e5\u6709 Rails\uff0c\u6240\u4ee5\u65e2\u7136\u662f\u6784\u5efa\u670d\u52a1\u7aef\u5e94\u7528 DLang \u4e5f\u540c\u6837\u62e5\u6709\u4e00\u4e2a\u4ee3\u8868\u6027\u7684\u6846\u67b6 Hunt Framework\u3002<\/p>\n

\u6570\u636e\u5e93\u64cd\u4f5c<\/strong><\/strong><\/span><\/div>\n

\u6570\u636e\u5e93\u64cd\u4f5c\u662f\u5927\u90e8\u5206\u5e94\u7528\u9879\u76ee\u90fd\u4e0d\u53ef\u6216\u7f3a\u7684\u4e00\u4e2a\u57fa\u672c\u64cd\u4f5c\uff0c\u64cd\u4f5c\u65b9\u5f0f\u4e3b\u8981\u6709\u4e24\u79cd\uff1a\u7f16\u5199 SQL \u811a\u672c\u548c ORM\u3002
\n\u76f4\u63a5\u64cd\u4f5c\u6570\u636e\u5e93\u7684 D \u8bed\u8a00\u5f00\u5e93\u6709 ddbc \/ (http:\/\/code.dlang.org\/packages\/ddbc)hunt-database \u7b49\uff0c\u652f\u6301\u7684\u6570\u636e\u5e93\u5305\u62ec MySQL\u3001PostgreSQL \u548c SQLite \u7b49\u3002\u5176\u4e2d\uff0c\u65b0\u7248\u672c\u7684 hunt-database \u7684\u5e95\u5c42\u9a71\u52a8\u5e93\u5df2\u4ece\u7ed1\u5b9a C \u8bed\u8a00\u7684\u65b9\u5f0f\u5347\u7ea7\u4e3a\u4e86\u76f4\u63a5\u4f7f\u7528 D \u8bed\u8a00\u5b9e\u73b0\uff0c\u51cf\u5c11\u4e86\u5bf9\u7b2c\u4e09\u65b9\u5e93\u7684\u4f9d\u8d56\u3002
\n\u91c7\u7528 ORM \u65b9\u5f0f\u7684 D \u8bed\u8a00\u5f00\u5e93\u6709 hibernated \/ hunt-entity \u7b49\u3002\u5176\u4e2d\uff0chunt-entity \u501f\u9274\u4e86 Java JPA \u548c spring-data-jpa \u7684\u6982\u5ff5\uff0c\u5de5\u4e1a\u5316\u7a0b\u5ea6\u9ad8\uff0c\u64cd\u4f5c\u5408\u7406\u5e76\u4e14\u6613\u4e8e\u7ef4\u62a4\u3002<\/p>\n

\u5fae\u670d\u52a1\u76f8\u5173<\/strong><\/strong><\/span><\/div>\n

hunt-service \u662f\u57fa\u4e8e gRPC \u534f\u8bae\u7684\u5206\u5e03\u5f0f RPC \u670d\u52a1\u5668\u4e0e\u5ba2\u6237\u7aef\u5e93\uff0c\u5f88\u5bb9\u6613\u4f7f\u7528\uff0c\u4e5f\u975e\u5e38\u65b9\u4fbf\u4e0e hunt-framework \u6574\u5408\u6784\u5efa\u5fae\u670d\u52a1\u67b6\u6784\u3002
\nneton \u662f\u57fa\u4e8e raft \u7b97\u6cd5\u7684\u5206\u5e03\u5f0f\u670d\u52a1\u53d1\u73b0\u6ce8\u518c\u5e94\u7528\u670d\u52a1\u3002<\/p>\n

GUI \u5e94\u7528<\/strong><\/strong><\/span><\/div>\n

\u5176\u5b9e D \u8bed\u8a00\u7684\u63a8\u51fa\u6bd4\u8f83\u65e9\uff0c\u6240\u4ee5 GTK \u7684\u6574\u5408\u975e\u5e38\u5b8c\u6574\uff0c\u4f17\u6240\u5468\u77e5 gtk \u5b98\u65b9\u7684 vala \u8bed\u8a00\u4e5f\u5927\u91cf\u501f\u9274\u4e86 D \u7684\u8bed\u8a00\u8bbe\u8ba1\uff0c\u6240\u4ee5 gtkd \u80fd\u591f\u975e\u5e38\u65b9\u4fbf\u7684\u6784\u5efa\u5ba2\u6237\u7aef\u5e94\u7528\uff0c\u5b98\u65b9\u4e5f\u6709\u5f00\u53d1\u8005\u63a8\u51fa\u4e86\u65b0\u7684\u6559\u7a0b\u7ad9\u70b9\u975e\u5e38\u68d2\uff1agtkDcoding | Simple examples of how to use GtkD to build GUI applications(https:\/\/gtkdcoding.com\/)
\n\u6b64\u5916\uff0c\u7eaf D \u8bed\u8a00\u5b9e\u73b0\u7684\u8de8\u5e73\u53f0 GUI \u5e93 dlangui \u4e5f\u6709\u4e0d\u4fd7\u7684\u8868\u73b0\uff0c\u6709\u4e00\u4e2a DLangIDE \u5c31\u662f\u57fa\u4e8e\u5b83\u5b9e\u73b0\u7684\u3002\u66f4\u591a GUI \u5e93\u53ef\u4ee5\u53c2\u8003\u8fd9\u91cc\u3002<\/p>\n

\u7cfb\u7edf\u5e94\u7528<\/strong><\/strong><\/span><\/div>\n

\u5728\u7f16\u8bd1\u5668\u65b9\u9762\uff0cDMD \u524d\u7aef\u5df2\u5b9e\u73b0\u81ea\u4e3e\u3002\u5728\u64cd\u4f5c\u7cfb\u7edf\u65b9\u9762\uff0c\u6709 PowerNex(https:\/\/github.com\/xomboverlord\/xomb\/tree\/unborn) \u4e0e Trinix \u7b49\u7cfb\u7edf\u5c1d\u8bd5\u3002\u7f16\u8bd1\u5668 LDC \u751a\u81f3\u5141\u8bb8\u5728\u66f4\u591a\u7684\u7cfb\u7edf\u5e73\u53f0\u4e0b\u8fdb\u884c\u5e94\u7528\u5f00\u53d1\uff0c\u5982\u652f\u6301\u57fa\u4e8e ARM \u548c MIPS \u67b6\u6784\u7684\u5d4c\u5165\u5f0f\u7cfb\u7edf\u3001Android \u7cfb\u7edf\u7b49\u3002<\/p>\n

\u79d1\u5b66\u8ba1\u7b97<\/strong><\/strong><\/span><\/div>\n

\u73b0\u5728\u4f7f\u7528 D \u8bed\u8a00\u53ef\u4ee5\u65b9\u4fbf\u7684\u8fdb\u884c\u79d1\u5b66\u8ba1\u7b97\uff0cmir \u662f\u5176\u4e2d\u7684\u4f7c\u4f7c\u8005\uff0c\u5b83\u5bf9\u591a\u7ef4\u6570\u7ec4\u8ba1\u7b97\u63d0\u4f9b\u4e86\u4f18\u79c0\u7684\u652f\u6301\uff0c\u6027\u80fd\u8d85\u8d8a\u4e86\u8bb8\u591a\u6570\u503c\u8ba1\u7b97\u5e93\uff0c\u8fbe\u5230\u5546\u4e1a\u6c34\u5e73\u3002<\/p>\n

\u7ed3\u8bed<\/strong><\/strong><\/div>\n

\u7b80\u5355\u6765\u8bf4\uff0cD \u8bed\u8a00\u662f\u4e00\u95e8\u5728\u5404\u4e2a\u9886\u57df\u5177\u6709\u4f18\u52bf\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u540c\u65f6\u5b83\u5f53\u524d\u7684\u751f\u6001\u4e5f\u5728\u4e0d\u65ad\u53d1\u5c55\uff0c\u672c\u6587\u5e0c\u671b\u901a\u8fc7\u7b80\u5355\u7684\u4ecb\u7ecd\uff0c\u8ba9\u5f00\u53d1\u8005\u91cd\u65b0\u8ba4\u8bc6 D \u8bed\u8a00\u3002\u5982\u679c\u4f60\u8fd8\u4e0d\u4e86\u89e3 D \u8bed\u8a00\uff0c\u8bfb\u5b8c\u672c\u6587\uff0c\u5e0c\u671b\u4f60\u5bf9\u5b83\u4ea7\u751f\u5174\u8da3\uff1b\u5982\u679c\u4f60\u6b64\u524d\u6709\u542c\u8bf4\u8fc7 D \u8bed\u8a00\uff0c\u8bfb\u5b8c\u672c\u6587\uff0c\u5e0c\u671b\u4f60\u80fd\u91cd\u65b0\u8ba4\u8bc6\u5b83\uff1b\u5982\u679c\u4f60\u5bf9 Web \u5f00\u611f\u5174\u8da3\uff0c\u8bf7\u6301\u7eed\u5173\u6ce8\u672c\u7cfb\u5217\u63a5\u4e0b\u6765\u7684 Web \u5e94\u7528\u7bc7\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

D \u8bed\u8a00\u662f\u4e00\u95e8\u8bed\u6cd5\u76f8\u5f53\u4f18\u96c5\u7684\u7f16\u8bd1\u578b\u8bed\u8a00\uff0c\u81ea 1999 \u5e74\u53d1\u5e03\u81f3\u4eca\u5df2\u53d1\u5c55\u4e86 20 \u5e74\uff0c\u5b83\u65e2\u62e5\u6709 Java \u90a3\u6837\u5f3a […]<\/p>\n","protected":false},"author":1898,"featured_media":163064,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[457],"class_list":["post-163058","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread","tag-d-"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/163058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/1898"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=163058"}],"version-history":[{"count":4,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/163058\/revisions"}],"predecessor-version":[{"id":163153,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/163058\/revisions\/163153"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/163064"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=163058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=163058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=163058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}