{"id":1974,"date":"2019-03-03T20:20:49","date_gmt":"2019-03-03T20:20:49","guid":{"rendered":"http:\/\/dlang.org\/blog\/?p=1974"},"modified":"2021-10-08T11:03:46","modified_gmt":"2021-10-08T11:03:46","slug":"dmd-2-085-0-and-dconf-2019-news","status":"publish","type":"post","link":"https:\/\/dlang.org\/blog\/2019\/03\/03\/dmd-2-085-0-and-dconf-2019-news\/","title":{"rendered":"DMD 2.085.0 and DConf 2019 News"},"content":{"rendered":"<p>Coinciding with news of a new release of DMD is news about DConf 2019 in London. From new GC options in DRuntime to free beers and free tours at DConf, we may as well kill two birds with one blog post!<\/p>\n<h2 id=\"compilernews\">Compiler news<\/h2>\n<p>The 2.085.0 release of DMD, the D reference compiler, <a href=\"https:\/\/dlang.org\/download.html\">is now ready for download<\/a>. Among other things, this release sees support for 32-bit OS X removed, more support for interfacing with Objective-C, and big news on the garbage collection front. There\u2019s also been some work on compatibility with the standard C++ library. In total, 2.085.0 represents 58 closed Bugzilla issues and the efforts of 49 contributors. <a href=\"https:\/\/dlang.org\/changelog\/2.085.0.html\">See the changelog<\/a> for the full details.<\/p>\n<h3 id=\"interfacingwithobjective-c\">Interfacing with Objective-C<\/h3>\n<p>DMD has had limited support for binding with Objective-C for some time. This release expands that support to include classes, instance variables, and super calls.<\/p>\n<p>Previously, binding with Objective-C classes required using D interfaces. No longer. Now, Objective-C classes <a href=\"https:\/\/dlang.org\/changelog\/2.085.0.html#1_objc_class\">can be declared directly as D classes<\/a>. Decorate an Objective-C class with <code>extern(Objective-C)<\/code>, make use of the <code>@selector<\/code> attribute on the methods, and away you go.<\/p>\n<p>To better facilitate interaction between the two languages, such classes have slightly modified behavior. Any <code>static<\/code> and <code>final<\/code> methods in an <code>extern(Objective-C)<\/code> class are virtual. However, <code>final<\/code> methods still are forbidden from being overridden by subclasses. <code>static<\/code> methods are overridable.<\/p>\n<pre class=\"prettyprint lang-d\">extern (Objective-C)\r\nclass NSObject\r\n{\r\n    static NSObject alloc() @selector(\"alloc\");\r\n    NSObject init() @selector(\"init\");\r\n    void release() @selector(\"release\");\r\n}\r\n\r\nextern (Objective-C)\r\nclass Foo : NSObject\r\n{\r\n    override static Foo alloc() @selector(\"alloc\");\r\n    override Foo init() @selector(\"init\");\r\n\r\n    int bar(int a) @selector(\"bar:\")\r\n    {\r\n        return a;\r\n    }\r\n}\r\n\r\nvoid main()\r\n{\r\n    auto foo = Foo.alloc.init;\r\n    scope (exit) foo.release();\r\n\r\n    assert(foo.bar(3) == 3);\r\n}<\/pre>\n<p>It\u2019s also now possible <a href=\"https:\/\/dlang.org\/changelog\/2.085.0.html#2_objc_instance_variable\">to declare instance variables<\/a> in Objective-C classes and for a method in an Objective-C class <a href=\"https:\/\/dlang.org\/changelog\/2.085.0.html#3_objc_super_call\">to make a super call<\/a>.<\/p>\n<pre class=\"prettyprint lang-d\">extern (Objective-C)\r\nclass NSObject\r\n{\r\n    void release() @selector(\"release\");\r\n}\r\n\r\nextern (Objective-C)\r\nclass Foo : NSObject\r\n{\r\n    \/\/ instance variable\r\n    int bar;\r\n\r\n    int foo() @selector(\"foo\")\r\n    {\r\n        return 3;\r\n    }\r\n\r\n    int getBar() @selector(\"getBar\")\r\n    {\r\n        return bar;\r\n    }\r\n}\r\n\r\nextern (Objective-C)\r\nclass Bar : Foo\r\n{\r\n    static Bar alloc() @selector(\"alloc\");\r\n    Bar init() @selector(\"init\");\r\n\r\n    override int foo() @selector(\"foo\")\r\n    {\r\n        \/\/ super call\r\n        return super.foo() + 1;\r\n    }\r\n}<\/pre>\n<h3 id=\"newgcstuff\">New GC stuff<\/h3>\n<p>Perhaps the biggest of the GC news items is that DRuntime now ships with <a href=\"https:\/\/dlang.org\/changelog\/2.085.0.html#gc_precise\">a precise garbage collector<\/a>. This can be enabled on any executable compiled and linked against the latest DRuntime by passing the runtime option <code>--DRT-gcopt=gc:precise<\/code>. To be clear, this is <em>not<\/em> a DMD compiler option. Read <a href=\"https:\/\/dlang.org\/spec\/garbage.html#precise_gc\">the documentation on the precise GC<\/a> for more info.<\/p>\n<p>Another new GC configuration option controls <a href=\"https:\/\/dlang.org\/changelog\/2.085.0.html#gc_cleanup\">the behavior of the GC at program termination<\/a>. Currently, the GC runs a collection at termination. This is to present the opportunity to finalize any live objects still holding on to resources that might affect the system state. However, this doesn\u2019t guarantee all objects will be finalized as roots may still exist, nor is the need for it very common, so it\u2019s often just a waste of time. As such, a new <code>cleanup<\/code> option allows the user of a D program to specify three possible approaches to GC clean up at program termination:<\/p>\n<ul>\n<li><code>collect<\/code>: the default, current, behavior for backward compatibility<\/li>\n<li><code>none<\/code>: do no cleanup at all<\/li>\n<li><code>finalize<\/code>: unconditionally finalize all live objects<\/li>\n<\/ul>\n<p>This can be passed on the command line of a program compiled and linked against DRuntime as, e.g. <code>--DRT-gcopt=cleanup:finalize<\/code>.<\/p>\n<p>All DRuntime options, including the two new ones, can be set up in code rather than being passed on the command line by declaring and initializing an array of strings called <code>rt_options<\/code>. It must be both <code>extern(C)<\/code> and <code>__gshared<\/code>:<\/p>\n<pre class=\"prettyprint lang-d\">extern(C) __gshared string[] rt_options = [\"gcopt=gc:precise cleanup:none\"];<\/pre>\n<p>See the documentation on <a href=\"https:\/\/dlang.org\/spec\/garbagea.html#gc_config\">configuring the garbage collector<\/a> for more GC options.<\/p>\n<p>Additional GC-related enhancements include programmatic <a href=\"https:\/\/dlang.org\/changelog\/2.085.0.html#core-memory-gc-profile-stats\">access to GC profiling statistics<\/a> and <a href=\"https:\/\/dlang.org\/changelog\/2.085.0.html#gc_registry\">a new GC registry<\/a> that allows user-supplied GCs to be linked with the runtime (see <a href=\"https:\/\/dlang.org\/spec\/garbage.html#gc_registry\">the documentation for details<\/a>).<\/p>\n<h3 id=\"standardc\">Standard C++<\/h3>\n<p>There are two enhancements to D\u2019s C++ interface in this release. The first is found in <a href=\"https:\/\/dlang.org\/changelog\/2.085.0.html#cpp_new\">the new DRuntime module, <code>core.stdcpp.new_<\/code><\/a>. This provides access to the global C++ <code>new<\/code> and <code>delete<\/code> operators so that D programs can allocate from the C++ heap. The second <a href=\"https:\/\/dlang.org\/changelog\/2.085.0.html#std_allocator\">is the new <code>core.stdcpp.allocator<\/code> module<\/a>, which exposes the <code>std::allocator&lt;T&gt;<\/code> class of C++ as a foundation for binding to the STL container types that allocate.<\/p>\n<h2 id=\"dconf2019news\">DConf 2019 news<\/h2>\n<p>There are two interesting perks for conference goers this year.<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1933\" src=\"http:\/\/dlang.org\/blog\/wp-content\/uploads\/2019\/01\/dconf_logo_2019.jpg\" alt=\"\" width=\"560\" height=\"200\" srcset=\"https:\/\/dlang.org\/blog\/wp-content\/uploads\/2019\/01\/dconf_logo_2019.jpg 560w, https:\/\/dlang.org\/blog\/wp-content\/uploads\/2019\/01\/dconf_logo_2019-300x107.jpg 300w\" sizes=\"(max-width: 560px) 100vw, 560px\" \/><\/p>\n<h3 id=\"thenightlygatheringspot\">The nightly gathering spot<\/h3>\n<p>We now have an \u201cofficial\u201d gathering spot. Usually at DConf, we pick an \u201cofficial\u201d hotel where the D Language Foundation folks and many attendees stay, but where a number of conference goers gather in the evenings after dinner. This year, a number of factors made it difficult to pick a reasonable spot, so we opted for something different.<\/p>\n<p>There\u2019s a cozy little pub around the corner from the venue, the Prince Arthur, that has a nice room on the second floor available for reservation. There\u2019s a limit on how many bodies we can pack in there at once, but folks generally come and go throughout the evening anyway. Any overflow can head downstairs to the public area. We\u2019ve got the room May 8, 9, and 10.<\/p>\n<p>Additionally, we\u2019ll be offering a couple of free rounds each night courtesy of Mercedes-Benz Research &amp; Development North America. Free drinks in a cozy backstreet London pub sounds like a great way to pass the time!<\/p>\n<p>Check out <a href=\"http:\/\/dconf.org\/2019\/venue.html\">the DConf venue page<\/a> for details about the Prince Arthur and how to get there.<\/p>\n<h3 id=\"afreetourbyjoolzguides\">A free tour by Joolz Guides<\/h3>\n<p><a href=\"https:\/\/joolzguides.com\/\">Julian McDonnell of Joolz Guides<\/a> will be taking some DConf registrants on a guided walk May 6 and 7. If you\u2019ve never <a href=\"https:\/\/www.youtube.com\/channel\/UCFWqceEDVxifaU3ljzMH5tg\">seen his YouTube channel<\/a>, we recommend it. His video guides are quirky, informative, and fun.<\/p>\n<p>This is available for free to all registrants, but <strong>space is limited<\/strong>! <a href=\"http:\/\/dconf.org\/2019\/registration.html\">When you register for DConf<\/a>, you\u2019ll receive information on how to reserve your spot. We\u2019ve arranged to have the tours in the mid-afternoon on both days so that folks arriving in the morning will have a chance to participate. This is a walking tour that will last somewhere between 3 &#8211; 4 hours, so be sure to wear comfortable shoes.<\/p>\n<p>The current plan is to start at Temple Station and end at London Bridge. We hope you join us!<\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/2JY-D_CUmOc\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<h3 id=\"deadlines\">Deadlines<\/h3>\n<p>The DConf submission deadline of March 10 is just around the corner. Now\u2019s the time to send in your proposal for a talk, demo, panel or research report. <a href=\"http:\/\/dconf.org\/2019\/index.html\">See the DConf 2019 homepage<\/a> for submission guidelines and selection criteria. And remember, speakers are eligible for reimbursement of travel and accommodation expenses.<\/p>\n<p>The early-bird registration deadline of March 17 is fast approaching. <a href=\"http:\/\/dconf.org\/2019\/registration.html\">Register now to take advantage<\/a> of the 15% discount!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Coinciding with news of a new release of DMD is news about DConf 2019 in London. From new GC options in DRuntime to free beers and free tours at DConf, we may as well kill two birds with one blog post! Compiler news The 2.085.0 release of DMD, the D reference compiler, is now ready [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,6,25,27],"tags":[],"_links":{"self":[{"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/posts\/1974"}],"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=1974"}],"version-history":[{"count":6,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/posts\/1974\/revisions"}],"predecessor-version":[{"id":1987,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/posts\/1974\/revisions\/1987"}],"wp:attachment":[{"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/media?parent=1974"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/categories?post=1974"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/tags?post=1974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}