{"id":983,"date":"2017-07-24T13:11:13","date_gmt":"2017-07-24T13:11:13","guid":{"rendered":"http:\/\/dlang.org\/blog\/?p=983"},"modified":"2021-10-08T11:12:29","modified_gmt":"2021-10-08T11:12:29","slug":"new-d-compiler-release-dmd-2-075-0","status":"publish","type":"post","link":"https:\/\/dlang.org\/blog\/2017\/07\/24\/new-d-compiler-release-dmd-2-075-0\/","title":{"rendered":"New D Compiler Release: DMD 2.075.0"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"size-full wp-image-181 alignleft\" src=\"http:\/\/dlang.org\/blog\/wp-content\/uploads\/2016\/08\/d6.png\" alt=\"\" width=\"200\" height=\"200\" \/>DMD 2.075.0 was released a few days back. As with every release, the changelog is available so you can\u00a0<a href=\"https:\/\/dlang.org\/changelog\/2.075.0.html\">browse the list of fixed bugs and new features<\/a>. 2.075.0 can be fetched from the\u00a0<a href=\"https:\/\/dlang.org\/download.html\">dlang.org download page<\/a>, which always makes available the latest DMD release alongside a nightly build.<\/p>\n<h3><a id=\"user-content-notable-changes\" class=\"anchor\" href=\"https:\/\/gist.github.com\/mdparker\/ee8372c0275c79037252ed087d70043c#notable-changes\" aria-hidden=\"true\"><\/a>Notable Changes<\/h3>\n<p>Every DMD release brings with it a number of bug fixes, changes, and enhancements. Here are some of the more noteworthy changes in this release.<\/p>\n<h4><a id=\"user-content-two-array-properties-removed\" class=\"anchor\" href=\"https:\/\/gist.github.com\/mdparker\/ee8372c0275c79037252ed087d70043c#two-array-properties-removed\" aria-hidden=\"true\"><\/a>Two array properties removed<\/h4>\n<p>Anyone who does a lot of work with D&#8217;s ranges will likely have encountered this little annoyance that arises from the built-in\u00a0<code>.sort<\/code>\u00a0property of arrays.<\/p>\n<pre class=\"prettyprint lang-d\" data-start-line=\"1\" data-visibility=\"visible\" data-highlight=\"\" data-caption=\"\">void main()\r\n{\r\n    import std.algorithm : remove, sort;\r\n    import std.array : array;\r\n    int[] nums = [5, 3, 1, 2, 4];\r\n    nums = nums.sort.remove(2).array;\r\n}<\/pre>\n<p>The\u00a0<code>.sort<\/code>\u00a0property has been deprecated for ages, so the above would result in the following error:<\/p>\n<pre class=\"prettyprint lang-plain_text\" data-start-line=\"1\" data-visibility=\"visible\" data-highlight=\"\" data-caption=\"\">sorted.d(6): Deprecation: use std.algorithm.sort instead of .sort property<\/pre>\n<p>The workaround would be to add an empty set of parentheses to the sort call. With DMD 2.075.0, this is no longer necessary and the above will compile. Both the\u00a0<code>.sort<\/code>\u00a0and\u00a0<code>.reverse<\/code>\u00a0array properties\u00a0<a href=\"http:\/\/dlang.org\/changelog\/2.075.0.html#removeArrayProps\">have finally been removed<\/a>\u00a0from the language.<\/p>\n<p>For the uninitiated, D has two features that have proven convenient in the functional pipeline programming style typically used with ranges. One is that parentheses on a function call are optional when there are no parameters. The other is\u00a0<a href=\"https:\/\/tour.dlang.org\/tour\/en\/gems\/uniform-function-call-syntax-ufcs\">Universal Function Call Syntax (UFCS)<\/a>, which allows a function call to be made using the dot notation on the first argument, so that a function\u00a0<code>int add(int a, int b)<\/code>\u00a0can be called as:\u00a0<code>10.add(5)<\/code>.<\/p>\n<p>Each of D&#8217;s built-in types comes with a set of built-in properties. Given that the built-in properties are not functions, no parentheses are used to access them. The\u00a0<code>.sort<\/code>\u00a0array property has been around since the early days of D1. At the time, it was rather useful and convenient for anyone who was happy with the default implementation. When D2 came along with the range paradigm, the standard library was given a set of functions that can treat arrays as ranges, opening them up to use with the many range based functions in the\u00a0<code>std.algorithm<\/code>\u00a0package and elsewhere.<\/p>\n<p>With optional parentheses, UFCS, and a range-based function in\u00a0<code>std.algorithm<\/code> called\u00a0<code>sort<\/code>, conflict was inevitable. Now range-based programmers can put that behind them and take one more pair of parentheses out of their pipelines.<\/p>\n<h4><a id=\"user-content-the-breaking-up-of-stddatetime\" class=\"anchor\" href=\"https:\/\/gist.github.com\/mdparker\/ee8372c0275c79037252ed087d70043c#the-breaking-up-of-stddatetime\" aria-hidden=\"true\"><\/a>The breaking up of std.datetime<\/h4>\n<p>The\u00a0<code>std.datetime<\/code>\u00a0module has had a reputation as the largest module in D&#8217;s standard library. Some developers have been known to use it a stress test for their tooling. It was added to the library long before D got the special\u00a0<a href=\"http:\/\/dlang.org\/spec\/module.html#package-module\">package module<\/a>\u00a0feature, which allows multiple modules in a package to be imported as a single module.<\/p>\n<p>Once package modules were added, Jonathan M. Davis, the original <code>std.datetime<\/code> developer, found it challenging to split the monolith into multiple modules. Then, at\u00a0<a href=\"http:\/\/dconf.org\/2017\/index.html\">DConf 2017<\/a>, he could be seen toiling away on his laptop in the conference hall and the hotel lobby. On the final day of the conference, the day of the DConf Hackathon, he announced that\u00a0<code>std.datetime<\/code>\u00a0was now a package. DMD 2.075.0 is\u00a0<a href=\"http:\/\/dlang.org\/changelog\/2.075.0.html#split-std-datetime\">the first release<\/a>\u00a0where the new module structure is available.<\/p>\n<p>Any existing code using the old module should still compile. However, any static libraries or object files lying around with the old symbols stuffed inside may need to be recompiled.<\/p>\n<h4><a id=\"user-content-colorized-compiler-messages\" class=\"anchor\" href=\"https:\/\/gist.github.com\/mdparker\/ee8372c0275c79037252ed087d70043c#colorized-compiler-messages\" aria-hidden=\"true\"><\/a>Colorized compiler messages<\/h4>\n<p>This one is missing from the changelog. DMD now has the ability to output colorized messages. The implementation required going through the existing error messages and properly annotating them where appropriate, so there may well be some messages for which the colors are missing. Also, given that this is a brand new feature and people can be picky about their terminal colors, more work will likely be done on this in the future. Perhaps that might include support for customization.<\/p>\n<p>&nbsp;<\/p>\n<h4><a id=\"user-content-compiler-ddoc-documentation-online\" class=\"anchor\" href=\"https:\/\/gist.github.com\/mdparker\/ee8372c0275c79037252ed087d70043c#compiler-ddoc-documentation-online\" aria-hidden=\"true\"><\/a>Compiler Ddoc documentation online<\/h4>\n<p>DMD, though originally written in C++, was converted to D some time ago. Now that more D programmers are able to contribute to the compiler, work has gone into documenting its source using D&#8217;s built-in\u00a0<a href=\"https:\/\/tour.dlang.org\/tour\/en\/gems\/documentation\">Ddoc syntax<\/a>. The result is now online, accessible from the sidebar of the existing library reference. A good starting point is the\u00a0<a href=\"https:\/\/dlang.org\/phobos\/ddmd_mars.html\">ddmd.mars module<\/a>.<\/p>\n<h3><a id=\"user-content-and-more\" class=\"anchor\" href=\"https:\/\/gist.github.com\/mdparker\/ee8372c0275c79037252ed087d70043c#and-more\" aria-hidden=\"true\"><\/a>And more&#8230;<\/h3>\n<p>The above is a small part of the bigger picture. The\u00a0<a href=\"http:\/\/dlang.org\/changelog\/2.075.0.html#bugfix-list\">bugfix list<\/a>\u00a0shows 89 bugs, regressions, and enhancements across the compiler, runtime, standard library, and web site. See\u00a0<a href=\"http:\/\/dlang.org\/changelog\/2.075.0.html\">the full changelog<\/a>\u00a0for the details.<\/p>\n<p>Thanks to everyone who contributed to this release, whether it was by reporting issues, submitting or reviewing pull requests, testing out the beta, or carrying out any of the numerous small tasks that help a new release see the light of day.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DMD 2.075.0 was released a few days back. As with every release, the changelog is available so you can\u00a0browse the list of fixed bugs and new features. 2.075.0 can be fetched from the\u00a0dlang.org download page, which always makes available the latest DMD release alongside a nightly build. Notable Changes Every DMD release brings with it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[26,12,8,27,4],"tags":[],"_links":{"self":[{"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/posts\/983"}],"collection":[{"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/comments?post=983"}],"version-history":[{"count":11,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/posts\/983\/revisions"}],"predecessor-version":[{"id":999,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/posts\/983\/revisions\/999"}],"wp:attachment":[{"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/media?parent=983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/categories?post=983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/tags?post=983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}