<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The One With D &#187; Discussion</title>
	<atom:link href="http://dblog.aldacron.net/category/discussion/feed/" rel="self" type="application/rss+xml" />
	<link>http://dblog.aldacron.net</link>
	<description>News and Opinions Regarding the D Programming Language</description>
	<lastBuildDate>Wed, 01 Feb 2012 11:41:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Libraries and Version Statements (or I Feel Really Silly)</title>
		<link>http://dblog.aldacron.net/2010/11/28/libraries-and-version-statements-or-i-feel-really-silly/</link>
		<comments>http://dblog.aldacron.net/2010/11/28/libraries-and-version-statements-or-i-feel-really-silly/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 12:28:59 +0000</pubDate>
		<dc:creator>Aldacron</dc:creator>
				<category><![CDATA[D Programming]]></category>
		<category><![CDATA[Derelict]]></category>
		<category><![CDATA[Discussion]]></category>
		<category><![CDATA[D1]]></category>
		<category><![CDATA[D2]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://dblog.aldacron.net/?p=848</guid>
		<description><![CDATA[Some time ago, I took the wholly needless and obsessive step of segregating all of the non-platform-specific OpenGL extension types and function declarations into version blocks in DerelictGL. There&#8217;s DerelictGL_EXT for the GL_EXT family of functions; DerelictGL_ARB for the GL_ARB &#8230; <a href="http://dblog.aldacron.net/2010/11/28/libraries-and-version-statements-or-i-feel-really-silly/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some time ago, I took the wholly needless and obsessive step of segregating all of the non-platform-specific OpenGL extension types and function declarations into version blocks in DerelictGL. There&#8217;s DerelictGL_EXT for the GL_EXT family of functions; DerelictGL_ARB for the GL_ARB family; DerelictGL_NV for the GL_NV family; and so on. My intent was to reduce the number of symbols in the compiled library and, given that all of the functions are declared in string mixins for D1/2 compatibility, maybe cut down a bit on compile time. The end result is that, yes, there was a difference in the library&#8217;s size, but it was negligible. As for compile time, well, not a big deal there either. Anyway, I kept it.</p>
<p>In the makefile, I had what I figured will be the most commonly used extension families on by default: EXT, ARB, NV, ATI and AMD. The user had only to add other needed families when building the library, or just comment out the line and uncomment another line that specifies DerelictGL_ALL for all extensions. It all seemed like a fine idea at the time. Unfortunately, given that I haven&#8217;t had any projects at all going on for a while, I haven&#8217;t been eating my own dog food.</p>
<p>A few days ago there was <a href="http://www.dsource.org/forums/viewtopic.php?t=5687" target="_blank">a post in the Derelict forums</a> specifying a problem that seemed puzzling on the surface, but to which I thought I had a simple solution. When compiling anything using OpenGL extensions, errors like the following were popping up:</p>
<blockquote><p>Error: undefined identifier glGenFramebuffersEXT<br />
Error: undefined identifier GL_FRAMEBUFFER_EXT<br />
Error: undefined identifier glActiveTextureARB<br />
&#8230;</p></blockquote>
<p><em>Obviously</em>, thought I, <em>he&#8217;s compiling DerelictGL without specifying any versions, meaning he&#8217;s not using the provided makefiles or DSSS</em>.  Of course, when I pointed out what the problem might be, I received a reply that shot it down. If you are a regular D user, you will understand where this is going. Unless you&#8217;re having a brain cramp like I did.</p>
<p>I was puzzled. Confused. Bewildered. So I took the test case and compiled it myself. I got the same errors. Luckily, I already knew somewhere in my subconsciousness what was going on, so it didn&#8217;t take that long to bubble to the surface. But I did go through a couple of false starts, thinking first that there was a problem with version statements and string mixins. Then, after posting about it in the forums, I realized that string mixins have nothing to do with it. So it was a problem with version statements. Then, after starting a new post in the forums, I realized that it wasn&#8217;t a problem at all. This is how version statements work.</p>
<p>If you&#8217;re a newcomer to D, or just haven&#8217;t caught on yet, the problem is simple. When you create a D program using a library that has been compiled with specific version statements, the library binary will contain the symbols defined by those versions. However, when compiling your program, the compiler has no idea which versions were used to compile the library. So if you add any types or function calls that are declared in version statements in the library modules, the compiler will rightly complain that they don&#8217;t exist. They aren&#8217;t visible when compiling your program unless you add the same versions to your command line. The converse of this is that if you use versions to compile your program that weren&#8217;t used to compile the library, you&#8217;ll get errors when linking&#8211;anything defined in version statements from imported modules will be visible to the compiler, but the symbols won&#8217;t be present in the library.</p>
<p>For some reason, I had it in my head that simply compiling the library with the appropriate version statements would be all that is required. Boy, do I feel silly. As a result of this, I&#8217;ve turned on support for all OpenGL extensions by adding version=DerelictGL_ALL to the relevant source modules. Doing it in the makefile would result in the same problem, requiring users to add -verison=DerelictGL_ALL to the command line when building their apps. So if you pull down Derelict2 from svn and want to use OpenGL extensions, you shouldn&#8217;t be surprised with compilation errors from Derelict anymore.</p>
<p>Now, the question I have is this. Is this behavior desirable? This is analogous to issues with libraries using #define to turn features on and off  in C and C++ (silly you, forgetting to add #define USE_DOUBLES_INSTEAD_OF_FLOATS when linking with that nifty, precompiled physics library). But despite the fact that I&#8217;m a long time C user accustomed to this sort of behavior (not to mention the number of years I&#8217;ve been around D), I still expected versions in D to behave differently. Wouldn&#8217;t it be cool if it did? What if there were a way to automatically pull in the versions a library uses when compiling your app, so that you don&#8217;t have to bother adding anything to the command line? Food for thought.</p>
]]></content:encoded>
			<wfw:commentRss>http://dblog.aldacron.net/2010/11/28/libraries-and-version-statements-or-i-feel-really-silly/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>D1/D2 Compatibility Annoyances</title>
		<link>http://dblog.aldacron.net/2010/01/27/d1d2-compatibility-annoyances/</link>
		<comments>http://dblog.aldacron.net/2010/01/27/d1d2-compatibility-annoyances/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 12:52:41 +0000</pubDate>
		<dc:creator>Aldacron</dc:creator>
				<category><![CDATA[Derelict]]></category>
		<category><![CDATA[Discussion]]></category>
		<category><![CDATA[D1]]></category>
		<category><![CDATA[D2]]></category>

		<guid isPermaLink="false">http://dblog.aldacron.net/?p=720</guid>
		<description><![CDATA[An annoying aspect of D for me these days, as a library maintainer, is keeping compatibility between D2 and D1. Derelict is very simple in terms of code. Aside from the shared library loading routines and a bit of logic &#8230; <a href="http://dblog.aldacron.net/2010/01/27/d1d2-compatibility-annoyances/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>An annoying aspect of D for me these days, as a library maintainer, is keeping compatibility between D2 and D1. <a href="http://www.dsource.org/projects/derelict/browser/branches/Derelict2" target="_blank">Derelict</a> is very simple in terms of code. Aside from the shared library loading routines and a bit of logic in the DerelictGL package to help with OpenGL context management and extension loading,  the majority of the project is just a bunch of enums and function pointer declarations. When I got started on the Derelict2 branch, the goal of which was to add support for D2 (in addition to the D1-Phobos/Tango support already there) I didn&#8217;t anticipate any issues. I was wrong.</p>
<p>The first issue I came across was with <strong>const</strong>/<strong>immutable</strong>. Some of the Phobos routines I needed to call (particularly from std.string and std.conv) use simple <strong>char</strong> arrays in D1, but use <strong>immutable(char)[]</strong> in D2. This was easily fixed with aliases. This is also where the first annoyance came. Because of the nature of version statements, everything inside a <strong>version(D_Version2)</strong> block is still parsed in D1. I had seen this in the newsgroups before, so I knew the way around it was <em>string mixins</em>. That felt like a hack then, and it still does now. I mean, what&#8217;s the point of a <strong>D_Version2 </strong>if we have to use mixins to do anything with it?</p>
<p>Next came the declarations of the C function pointers. At first, I was going to ignore <strong>const</strong> in the C declarations entirely, just as I do in Derelict 1. Besides, I thought, function parameters in this case are dealt with on the C side, so the declaration on the D side shouldn&#8217;t matter. But, in the end I was convinced that this is impractical. So, I started making these declarations <strong>const</strong> correct. For function parameters, decorating with <strong>in</strong> rather than <strong>const</strong> does the trick and doesn&#8217;t require separate declarations for D1/2. The return values are a different story. Fortunately, there are very few functions that declare const return values in the C libraries with which Derelict binds. So for those few cases, I aliased to a common type based on D version, again, however reluctantly, using string mixins.</p>
<p>I was sure that my D2 compatibility issues were behind me at this point and began to port more of the Derelict trunk over to the new branch. Then not so long ago, someone brought up a new issue in the forums. When using multiple threads and D2&#8242;s <strong>shared</strong> paradigm, the function pointers in Derelict were being put in Thread Local Storage and were not usable outside of the thread in which they were loaded. The solution is to declare all of the function pointers <strong>__gshared</strong>. My reflexive, naive solution was to add a <strong>mixin(&#8220;__gshared:&#8221;)</strong> in front of the function pointer declarations in D2, and do nothing in D1. This, of course, doesn&#8217;t work. As I should have remembered from the <a href="http://www.dsource.org/forums/viewtopic.php?t=2873&amp;highlight=extern+windows" target="_blank">extern(C)/extern(Windows)</a> problem a while back.</p>
<p>So now, in order to make sure that all the function pointers and any other global variables actually are global in D2, we need to declare them as <strong>__gshared</strong>, while declaring them normally in D1. The only solution I see that still fits with Derelict&#8217;s philosophy of sticking as close to the original, bound APIs as possible, is to wrap all of the global declarations in <em>string mixins</em>. This, to me, is just absolutely ridiculous. It&#8217;s not difficult to do and doesn&#8217;t really add much to maintenance, but on principle it&#8217;s just silly. A large portion of code in Derelict, somewhere around 50% or more I would guess, is about to become string mixins. Yuck. What a hack.</p>
<p>In C it would be a simple matter of a couple of preprocessor defines. We absolutely need something that simple in D, rather than resorting to mixing in all of the code in multiple modules. I think the majority of people who are concerned about D1/2 compatibility are library maintainers. I wonder, with such a hackish solution for maintaining compatibility, how many won&#8217;t just shrug their shoulders and drop D1 support altogether? I&#8217;m tempted to, but I know that&#8217;s quite impractical given that a number of Derelict users are also Tango users, which is D1-only.</p>
<p>So, am I the only one that would like a nice solution that can allow D1/2 compatibility without resorting to mixins? A <strong>D_Version2</strong> block that is ignored in D1 would be a good start. Allowing statements like <strong>__gshared:</strong> to affect everything following the version block in which it&#8217;s declared would be another. And if that&#8217;s not possible, then <em>something</em> that achieves the same result is all I&#8217;d want. I&#8217;d love to hear opinions on this situation.</p>
<p>Since it&#8217;s likely just wishful thinking on my part (this has been discussed in the newsgroups more than once and nothing has ever come of it), I&#8217;m already looking at ways to get the most bang for my buck. If I&#8217;m going to be forced to use string mixins, there&#8217;s got to be something I can do to take advantage of them. One thing I&#8217;m considering is DerelictObjects. Wouldn&#8217;t it be interesting if you could configure Derelict to use free functions, __gshared free functions, or to wrap the functions in classes based on your own preferences or project needs? Hmmm.</p>
]]></content:encoded>
			<wfw:commentRss>http://dblog.aldacron.net/2010/01/27/d1d2-compatibility-annoyances/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How Neat It Is</title>
		<link>http://dblog.aldacron.net/2009/03/08/how-neat-it-is/</link>
		<comments>http://dblog.aldacron.net/2009/03/08/how-neat-it-is/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 14:13:31 +0000</pubDate>
		<dc:creator>Aldacron</dc:creator>
				<category><![CDATA[D Programming]]></category>
		<category><![CDATA[Discussion]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://dblog.aldacron.net/?p=579</guid>
		<description><![CDATA[This may sound silly, but when working with D I sometimes catch myself just sitting here admiring the beauty of a source file. It never ceases to amaze me how neat and concise D code can be. I don&#8217;t think &#8230; <a href="http://dblog.aldacron.net/2009/03/08/how-neat-it-is/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This may sound silly, but when working with D I sometimes catch myself just sitting here admiring the beauty of a source file. It never ceases to amaze me how neat and concise D code can be. I don&#8217;t think I&#8217;ve just sat and stared at a source file that way since I first started learning how to program. There&#8217;s something quite gratifying about it at times. And now that I&#8217;m using D more than ever, I often find myself in quite the good mood when I finally close my text editor at the end of a coding session. I hope I&#8217;m not the only one <img src='http://dblog.aldacron.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://dblog.aldacron.net/2009/03/08/how-neat-it-is/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Mayhem Intergalactic on Steam</title>
		<link>http://dblog.aldacron.net/2009/02/01/mayhem-intergalactic-on-steam/</link>
		<comments>http://dblog.aldacron.net/2009/02/01/mayhem-intergalactic-on-steam/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 03:44:13 +0000</pubDate>
		<dc:creator>Aldacron</dc:creator>
				<category><![CDATA[Discussion]]></category>
		<category><![CDATA[Gamedev/Games]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://dblog.aldacron.net/?p=557</guid>
		<description><![CDATA[Some of you may recall that the indie game Mayhem Intergalactic was created with D. I read a while ago at the Indie Gamer forums that it was going to be published on Steam, though I don&#8217;t recall if Chris &#8230; <a href="http://dblog.aldacron.net/2009/02/01/mayhem-intergalactic-on-steam/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some of you may recall that the indie game <a href="http://www.inventivedingo.com/mayhemig">Mayhem Intergalactic</a> was created with D. I read a while ago <a href="http://forums.indiegamer.com/showthread.php?t=15120&amp;page=2&amp;highlight=Mayhem+Intergalactic+Steam">at the Indie Gamer forums</a> that it was going to be published on <a href="http://store.steampowered.com/about/">Steam</a>, though I don&#8217;t recall if Chris announced it in the D newsgroups. As I was checking Steam&#8217;s latest releases, I saw that the day has arrived. As of a week ago, <a href="http://store.steampowered.com/">Mayhem Intergalactic is available</a> to however many thousands of Steam users there are. Congratulations to Chris. I imagine he&#8217;ll see a nice jump in sales from this. The majority of the users won&#8217;t know or care that the game was made with D, but it&#8217;s good news for D all the same.</p>
]]></content:encoded>
			<wfw:commentRss>http://dblog.aldacron.net/2009/02/01/mayhem-intergalactic-on-steam/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>DSSS and I</title>
		<link>http://dblog.aldacron.net/2007/09/12/dsss-and-i/</link>
		<comments>http://dblog.aldacron.net/2007/09/12/dsss-and-i/#comments</comments>
		<pubDate>Wed, 12 Sep 2007 08:11:09 +0000</pubDate>
		<dc:creator>Aldacron</dc:creator>
				<category><![CDATA[Derelict]]></category>
		<category><![CDATA[Discussion]]></category>

		<guid isPermaLink="false">http://dblog.aldacron.net/2007/09/12/dsss-and-i/</guid>
		<description><![CDATA[After Gregor stopped posting Rebuild binaries separately from DSSS, I downloaded the dsss-light version for Windows, which is DSSS without all of the net stuff. All I really wanted was access to the Rebuild executable without building it myself. I &#8230; <a href="http://dblog.aldacron.net/2007/09/12/dsss-and-i/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After Gregor stopped posting <a href="http://www.dsource.org/projects/dsss/wiki/Rebuild">Rebuild</a> binaries separately from <a href="http://www.dsource.org/projects/dsss">DSSS</a>, I downloaded the dsss-light version for Windows, which is DSSS without all of the net stuff. All I really wanted was access to the Rebuild executable without building it myself. I don&#8217;t care how they do it in the Linux world, I want my binaries without having to compile them first, thank you.</p>
<p>So I don&#8217;t really need, or want, DSSS to manage my libraries for me. I&#8217;ve got my own system that works just fine. That, actually, is one of the reasons I never bothered to use DSSS before nor wanted to use it when I downloaded it. I also didn&#8217;t like that it generated .di files for everything. Nor did I like the idea that I had to learn how to create dsss.conf files in order to make it do what I wanted with my own projects. I was quite happy with using the simple response files I use for <a href="http://www.dsource.org/projects/build/">Bud</a> and Rebuild.</p>
<p>Recently, I came to realize that it would be a good idea to add a dsss.conf file to the <a href="http://www.dsource.org/projects/derelict">Derelict</a> trunk. Since more and more people are using <a href="http://www.dsource.org/projects/tango">Tango</a> with Derelict, and since the provided build script cannot be run by DMD when using Tango (at least on Windows, it has to be compiled into an executable first), DSSS seemed like it could potentially be a solution to the problem. So it was time to buckle down and dig into dsss.conf files.</p>
<p>As it turns out, creating a dsss.conf file is not nearly as complicated as the docs make it seem (Gregor did say doc writing isn&#8217;t one of his strengths). It wasn&#8217;t long before I had DSSS doing my bidding and building all of the Derelict libraries. There are still a few nits to work out, like I&#8217;m fairly certain that the DerelictSDL stuff is being compiled into every single DerelictSDL* library. I&#8217;d prefer that not to happen, but I haven&#8217;t yet seen any obvious way to exclude entire packages (nor have I really dug around for one or asked Gregor). There&#8217;s also a bug with library names that Gregor has already fixed for the next release. So when Gregor does release the next version, Derelict will be getting a dsss.conf file.</p>
<p>My intent was to provide dsss.conf alongside buildme.d, so that people who prefer can still run the build script. Some time ago I had refactored it to allow support for multiple build tools. That idea has now gone the way of the dodo, so I streamlined it and cleaned it up a bit just to support bud only. But now, I&#8217;m thinking, do I really need the build script? Providing two different methods of building the same project could potentially lead to confusion. I get enough confusion from just the single build script as it is. The majority of Derelict users don&#8217;t bother reading the docs, judging by the majority of support requests I get in the forum. I may very well drop the build script and just require dsss if you want to build the libraries.</p>
<p>Today, I set some time aside to get started on the new, <a href="http://dblog.aldacron.net/2007/09/10/reinventing-smoothie/">reinvented Smoothie</a>. The first thing I would normally do is set up a couple of response files for Rebuild (or Bud as the case may be) for debug/release configurations. This time, I decided to go with a dsss.conf file instead. I still don&#8217;t like that it generates .di files (is there a way to turn that off?) or creates extra files that I don&#8217;t need, but it&#8217;s not a big deal. Besides, a &#8216;dsss distclean&#8217; solves that problem.</p>
<p>Still, if that were all, I&#8217;d see no real reason to give up Rebuild for DSSS. The big things for me are the ability to set up multiple builds in a single config file and the variety of hooks and commands available. I tend to configure my projects in such a way that I often have multiple test apps set up in their own packages. Using Rebuild or Bud, I&#8217;d need to configure a separate response file for each app. Also, I can already see how some of the hooks are going to be very useful for setting up a complex build process that involves manipulating more than just D source files.</p>
<p>I&#8217;ve said before in a NG post that DSSS solves problems I don&#8217;t have. That&#8217;s true, to an extent, but I see now that there&#8217;s so much more to it than just library management and easy project compilation. To say I&#8217;ve warmed up to it is an understatement. I&#8217;ll be replacing the response files for my game, and any other projects I have lying around, with DSSS configuration files. Color me converted.</p>
<p>Technorati Tags: <a class="performancingtags" href="http://technorati.com/tag/D%20Programming%20Language" rel="tag">D Programming Language</a>, <a class="performancingtags" href="http://technorati.com/tag/DSSS" rel="tag">DSSS</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dblog.aldacron.net/2007/09/12/dsss-and-i/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>On Closures in D</title>
		<link>http://dblog.aldacron.net/2007/09/12/on-closures-in-d/</link>
		<comments>http://dblog.aldacron.net/2007/09/12/on-closures-in-d/#comments</comments>
		<pubDate>Wed, 12 Sep 2007 06:51:13 +0000</pubDate>
		<dc:creator>Aldacron</dc:creator>
				<category><![CDATA[D Programming]]></category>
		<category><![CDATA[Discussion]]></category>

		<guid isPermaLink="false">http://dblog.aldacron.net/2007/09/12/on-closures-in-d/</guid>
		<description><![CDATA[Slow news day for D, but there&#8217;s a blog post over at hans-eric.com titled, D doesn&#8217;t have real closures. Hans-Eric talks about D&#8217;s delegates, how they are similar to closures, and how they aren&#8217;t quite real closures because they don&#8217;t &#8230; <a href="http://dblog.aldacron.net/2007/09/12/on-closures-in-d/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Slow news day for D, but there&#8217;s a blog post over at <a href="http://www.hans-eric.com/">hans-eric.com</a> titled, <a href="http://www.hans-eric.com/2007/09/11/d-doesnt-have-real-closures/">D doesn&#8217;t have real closures</a>. Hans-Eric talks about D&#8217;s delegates, how they are similar to closures, and how they aren&#8217;t quite real closures because they don&#8217;t keep surrounding variables alive after the scope has changed. His conclusion is that it&#8217;s not a big deal, but at least one commenter so far disagrees with him.</p>
<p>Personally, I don&#8217;t see it as a big deal either. For my purposes, I don&#8217;t really need true closures in D. I do like to see them implemented in scripting languages, though. They are very handy for game AI. Since <a href="http://www.lua.org/">Lua</a> added closures, that has become one of its major selling points for game developers. If I do come across a case where a true closure would come in handy, I have no problem making use of an inner class instead. D just has so many other useful features, such as anonymous delegates and lazy evaluation (two among many), that not having true closures doesn&#8217;t bother me a bit.</p>
<p>Technorati Tags: <a class="performancingtags" href="http://technorati.com/tag/D%20Programming%20Language" rel="tag">D Programming Language</a>, <a class="performancingtags" href="http://technorati.com/tag/delegates" rel="tag">delegates</a>, <a class="performancingtags" href="http://technorati.com/tag/closures" rel="tag">closures</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dblog.aldacron.net/2007/09/12/on-closures-in-d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ooops! That&#8217;s Not a Feature!</title>
		<link>http://dblog.aldacron.net/2007/07/08/ooops-thats-not-a-feature/</link>
		<comments>http://dblog.aldacron.net/2007/07/08/ooops-thats-not-a-feature/#comments</comments>
		<pubDate>Sun, 08 Jul 2007 06:03:55 +0000</pubDate>
		<dc:creator>Aldacron</dc:creator>
				<category><![CDATA[Derelict]]></category>
		<category><![CDATA[Discussion]]></category>

		<guid isPermaLink="false">http://dblog.aldacron.net/2007/07/08/ooops-thats-not-a-feature/</guid>
		<description><![CDATA[In a recent post, I described a problem with DMD 1.018 and Derelict. I assumed it was a bug with the new compiler. As it turns out, the old behavior was a bug and the compiler is now working as &#8230; <a href="http://dblog.aldacron.net/2007/07/08/ooops-thats-not-a-feature/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://dblog.aldacron.net/2007/07/03/derelict-problems-with-dmd-1018/">a recent post</a>, I described a problem with <a href="http://www.digitalmars.com/d/1.0/changelog.html#new1_018">DMD 1.018</a> and <a href="http://www.dsource.org/projects/derelict">Derelict</a>. I assumed it was a bug with the new compiler. As it turns out, the old behavior was a bug and the compiler is now working as intended. It&#8217;s not a big deal for me, as the workaround isn&#8217;t too painful. I&#8217;ll be able to get Derelict patched up in due course and users of the library will be able to use Derelict with 1.018 and all future versions of DMD. Though, the fix I&#8217;m considering makes use of string mixins, so it won&#8217;t work with pre-CTFE versions of DMD. Though I might use template mixins instead. We&#8217;ll see.</p>
<p>Unfortunately, this issue goes beyond Derelict. There are several OpenGL bindings out there that are affected by this. If you are using one of them and have not yet upgraded your compiler, you will be in for a bit of a shock when you do. Here&#8217;s a list of the bindings I know of that use the same, no-longer-legal technique:</p>
<p><a href="http://www.dsource.org/projects/bindings">Bindings</a> &#8211; both the gl and glu modules are affected</p>
<p><a href="http://shinh.skr.jp/d/porting.html">D-porting</a> &#8211; both opengl.d and openglu.d, found in the opengl.zip file, are affected</p>
<p><a href="http://glfw.sourceforge.net/">GLFW</a> &#8211; three modules (in support/d/imports in the directory tree) are affected: gl.d, glu.d and glfw.d</p>
<p>If you are using any of the above modules, you will have to update them (or ask a maintainer to) to use them with DMD 1.018 and later. The old OpenGL binding at <a href="http://int19h.tamb.ru/files.html">DedicateD</a> is not affected, as it is not cross-platform (and is actually quite outdated by now, anyway).</p>
<p>There may be other D modules out there, bindings to libraries other than OpenGL or perhaps OpenGL bindings I&#8217;m unaware of, that are affected. If you find yourself using one of them, the offending code looks like, or similar to, this:</p>
<blockquote><pre>
version(Windows)
{
    extern(Windows):
}
else
{
    extern(C):
}

// function, or function pointer, declarations follow here
</pre>
</blockquote>
<p>Walter outlines some alternative solutions in <a href="http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&amp;article_id=55391">a newsgroup post</a>. Choose an option that works for you and roll with it.</p>
<p>Technorati Tags: <a class="performancingtags" href="http://technorati.com/tag/D%20Programming%20Language" rel="tag">D Programming Language</a>, <a class="performancingtags" href="http://technorati.com/tag/DMD" rel="tag">DMD</a>, <a class="performancingtags" href="http://technorati.com/tag/Digital%20Mars" rel="tag">Digital Mars</a>, <a class="performancingtags" href="http://technorati.com/tag/Derelict" rel="tag">Derelict</a>, <a class="performancingtags" href="http://technorati.com/tag/OpenGL%20bindings" rel="tag">OpenGL bindings</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dblog.aldacron.net/2007/07/08/ooops-thats-not-a-feature/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My New Project</title>
		<link>http://dblog.aldacron.net/2007/05/11/my-new-project/</link>
		<comments>http://dblog.aldacron.net/2007/05/11/my-new-project/#comments</comments>
		<pubDate>Fri, 11 May 2007 03:39:54 +0000</pubDate>
		<dc:creator>Aldacron</dc:creator>
				<category><![CDATA[Discussion]]></category>
		<category><![CDATA[Gamedev/Games]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Smoothie]]></category>

		<guid isPermaLink="false">http://dblog.aldacron.net/2007/05/11/my-new-project/</guid>
		<description><![CDATA[In a recent post I mentioned that I am working on a new project that I will eventually release as open source. I wanted to wait until I had a solid outline of the entire project before I talked about &#8230; <a href="http://dblog.aldacron.net/2007/05/11/my-new-project/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://dblog.aldacron.net/2007/05/08/making-the-move-to-d/">a recent post</a> I mentioned that I am working on a new project that I will eventually release as open source. I wanted to wait until I had a solid outline of the entire project before I talked about it. Well, I have so I am.</p>
<p>Not too long ago, Kevin Glass let loose the first point release of his 2D Java game library, <a href="http://slick.cokeandcode.com/">Slick</a>. I&#8217;ve been following his progress with Slick for a while now and thought it would be nifty to port to D. I didn&#8217;t bother with it though, because I didn&#8217;t see it as something I had time for. Besides, the D community already has Clay Smith&#8217;s <a href="http://www.dsource.org/projects/arclib">ArcLib</a>. When I decided to sit down and work on a test case as described in the post linked above, I thought about what would constitute a good project. Slick immediately came to mind. So I worked on it for a couple of days and then had the epiphany I wrote about.</p>
<p>All projects need a name. I thought about this for a bit and wanted to derive something from Slick. Eventually, I settled on Smoothie. I couldn&#8217;t find any other game libraries with the same name. Plus, I love drinking them.</p>
<p>While Smoothie is based on Slick, it is not a direct port. I&#8217;m going in a different direction with much of the design, though I am certainly using some of Slick verbatim. Like Derelict, I&#8217;m primarily writing this for me. I&#8217;ll also be developing a commercial game in tandem with the library, so that&#8217;s going to drive most of the design decisions for a while. But I do have milestones set out where I will make point releases of Smoothie under the BSD license.</p>
<p>The first milestone will allow the creation of simple 2D games, such as Pong, Asteroids, or Space Invaders. The second milestone will add special effects, simple GUI components, support for tile-based games, and more. Each milestone is set up to be an incremental improvement over the last. Though I haven&#8217;t gotten more than the first two milestones completely fleshed out, I am looking farther down the road. I&#8217;ve structured the framework such that it can, eventually, support different windowing APIs for OpenGL context creation (SDL, DFL, SWT, or what have you). It will also be able to support 3D rendering in addition to 2D, together or separately. For example, in a 2D game you could easily create a GUI component that rendered a 3D model such that it&#8217;s not part of the game world, but part of the UI. Or in a 3D game you could easily create a 2D GUI component for the player to play a mini-game (like, maybe, tetris) while waiting for the game to load, or as part of a challenge. You could then use the same code for the mini-game and release it as a completely separate game with very few changes.</p>
<p>I&#8217;m a long way off from the 3D bits yet, so you won&#8217;t be seeing that any time soon. I&#8217;ve got a couple of 2D game ideas I want to pump out first. But this should give you an idea of what Smoothie is and what my goals for it are. Once I&#8217;m ready for the first point release, I&#8217;ll ask Brad for a DSource project. I expect that to be early next month. Starting soon, I&#8217;ll be keeping a devlog detailing the progress of Smoothie and the games I make with it, over at <a href="http://gdmike.statbuff.com/">my game blog</a>.</p>
<p>Comments and questions are welcome!<br />&nbsp;</p>
<p>Technorati Tags: <a class="performancingtags" href="http://technorati.com/tag/D%20Programming%20Language" rel="tag">D Programming Language</a>, <a class="performancingtags" href="http://technorati.com/tag/Slick" rel="tag">Slick</a>, <a class="performancingtags" href="http://technorati.com/tag/Smoothie" rel="tag">Smoothie</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dblog.aldacron.net/2007/05/11/my-new-project/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Making the Move to D</title>
		<link>http://dblog.aldacron.net/2007/05/08/making-the-move-to-d/</link>
		<comments>http://dblog.aldacron.net/2007/05/08/making-the-move-to-d/#comments</comments>
		<pubDate>Tue, 08 May 2007 16:15:32 +0000</pubDate>
		<dc:creator>Aldacron</dc:creator>
				<category><![CDATA[D Programming]]></category>
		<category><![CDATA[Derelict]]></category>
		<category><![CDATA[Discussion]]></category>

		<guid isPermaLink="false">http://dblog.aldacron.net/2007/05/08/making-the-move-to-d/</guid>
		<description><![CDATA[When I first started following D, it was out of curiosity. When I started Derelict (which turned 3 years old last Friday, by the way &#8212; Happy Birthday, Derelict!), I did so with the goal of one day using it &#8230; <a href="http://dblog.aldacron.net/2007/05/08/making-the-move-to-d/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When I first started following D, it was out of curiosity. When I started <a href="http://www.dsource.org/projects/derelict/">Derelict</a> (which turned 3 years old last Friday, by the way &#8212; Happy Birthday, Derelict!), I did so with the goal of one day using it for my own personal projects. At the time, however, I was reluctant to start using D for anything else. Even after I started this blog over a year ago, I still was hesitant to pick up D for any production code. I toyed around with simple programs for some Derelict tests, or to try out new language features, but nothing more. Even while I was evangelizing D in other forums and communities, I was waiting for the &#8216;right moment&#8217; to start using it on a serious project myself.</p>
<p>For a long while now I&#8217;ve been working sporadically on a commercial game project using C. Progress has been slow primarily because I only spend a few hours a week working on it (if that). But there have been other speed bumps along the way, things that any C developer worth his salt will have encountered more often than he would like (as an example, I spent three days chasing down a memory corruption bug not too long ago). I love C, with all of its foibles and weaknesses, but there certainly are days when I feel like throwing my computer out of the window.</p>
<p>Not too long ago, with one of the more recent DMD releases, I started to get this nagging feeling that the time for D had arrived. The more I ignored it, the stronger it got. Seeing in the NG those glowing reviews by the <a href="http://www.team0xf.com/">team0xf</a> guys made it stronger still. So I decided to put it to the test on something other than Derelict and more than just a 10 minute test case. I quickly came up with a project idea and got to work.</p>
<p>After a several hours scattered over 2 days, I&#8217;ve already made great progress. Derelict requires only a small subset of D features, so though I&#8217;ve been aware of the benefits of using many of them, I&#8217;ve not actually seen any in production code until now. The more D I use on this project, the more I never want to see a line of C code again. In fact, I&#8217;ve already come to two decisions. For one, I&#8217;m going to move this test project forward into a production library. Second, I&#8217;m going to drop the C game project completely. I&#8217;ll eventually start over using D (it may seem to others like a waste of months of effort, but it&#8217;s really not a big deal). Before that, though, this new project has given me a couple of other ideas to work on.</p>
<p>Yeah, I&#8217;m going all out on this. I&#8217;ve typed up design documents, set up milestones and tasks on my local copy of <a href="http://www.activecollab.com/">activeCollab</a>, and I actually sat down and blocked off large chunks of time on my calendar for development. My game business has been something that I wanted to get up and running <i>sometime</i> in the next few years (i.e., no solid plan), but now the worm has turned and I&#8217;m focusing on it exclusively. I&#8217;ll continue teaching English, but I&#8217;m going to stop taking contract software development work completely. Contract work was the real time killer for me and it&#8217;s never been something I really enjoy (mostly J2EE stuff). There are a few other minor distractions I&#8217;m cutting out as well. From here on, I&#8217;ll consider myself a full time D game programmer!</p>
<p>There are two side-effects. The first is that I&#8217;ll be able to set aside more time to work on Derelict than I ever have been able to before. Since I&#8217;ll now be a Derelict user myself, I&#8217;ll get to see first-hand any warts that crop up (at least, on a subset of the packages). The second is that the little test project that started this enlightenment will be made publicly available under a BSD license.</p>
<p>The point of this post is to proclaim to the world that D has set me free! My old reluctance to use it for production code was warranted way back when, but I can see no justifiable reason not to use D in its current state. I can&#8217;t remember the last time I had this much fun typing code into a text editor. Thanks, Walter, for bringing D to where it is today.</p>
<p>Technorati Tags: <a class="performancingtags" href="http://technorati.com/tag/D%20Programming%20Language" rel="tag">D Programming Language</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dblog.aldacron.net/2007/05/08/making-the-move-to-d/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>D is Neither C++ Nor java</title>
		<link>http://dblog.aldacron.net/2006/09/15/d-is-neither-c-nor-java/</link>
		<comments>http://dblog.aldacron.net/2006/09/15/d-is-neither-c-nor-java/#comments</comments>
		<pubDate>Fri, 15 Sep 2006 20:12:18 +0000</pubDate>
		<dc:creator>Aldacron</dc:creator>
				<category><![CDATA[Discussion]]></category>

		<guid isPermaLink="false">http://dblog.aldacron.net/2006/09/15/d-is-neither-c-nor-java/</guid>
		<description><![CDATA[Get it in your head right now: D is not C++ and D is not Java! There is a natural tendency when learning a new language to, initially, attempt to use it the same as a language you are more &#8230; <a href="http://dblog.aldacron.net/2006/09/15/d-is-neither-c-nor-java/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Get it in your head right now: D is not C++ and D is not Java!</p>
<p>There is a natural tendency when learning a new language to, initially, attempt to use it the same as a language you are more familiar with. This is especially true when the two languages are similar in syntax. Since most newcomers to D seem to primarily come from C++ and Java, and since D is similar to both languages in many respects, people are naturally trying to shoehorn C++ and Java idioms into D, sometimes becoming frustrated when things don&#8217;t work as they expect.</p>
<p>Feature requests for functionality found in other languages are not uncommon on the D newsgroup. I personally think Walter has done a great job of sticking to his guns for the most part. Granted, some of the features that he relented on after the community harrassed him have turned out to be incredibly useful. Some have even given D a unique flavor that really sets it apart.</p>
<p>I would love to see reflection/introspection capabilities similar to Java or C#. That would really put D in a unique position, being the statically compiled systems language that it is. I wouldn&#8217;t mind seeing a more explicit syntax for properties, but it&#8217;s not something I consider a deal breaker. I can do without assignment overloads, but if such a thing ever did make it in, I wouldn&#8217;t cry about it.</p>
<p>So I have my opinions and everyone else has their own. But it&#8217;s not the feature requests and wishlists in and of themselves that prompted this post. It&#8217;s the reasoning behind some of them. I get the impression that some feature requests are made not because they are great ideas that would improve the language, but because they would bring D more in line with language X.</p>
<p>I shall repeat myself: D is not C++ and D is not Java!</p>
<p>One of the reasons so many C++ programmers have such a disdain for Java is because they can not, or will not, take their C++ hats off long enough to learn that Java isn&#8217;t C++. I have seen enough microbenchmarks, which are generally useless anyway, coded in Java by C++ programmers to know that C++ programmers can&#8217;t write Java code. When you whip out a Java compiler, you have to be wearing a Java hat.&nbsp; Operator overloading is not a feature in Java, so if you are <i>thinking in Java</i> you won&#8217;t miss it. The same holds true in reverse, of course &#8212; Java programmers need to be wearing a C++ hat when Stroustrup comes off of the shelf.</p>
<p>One more time: D is not C++ and D is not Java!</p>
<p>When you come to the Land of D, drop whatever hat you are wearing at the gate. Keep your fundamentals, because you&#8217;ll need those. Keep the memory of what it was like to wear that other hat, because sometimes those C++ or Java tricks may come in handy in the D world. But under no circumstance should you <i>expect</i> to find yourself on familiar terrain. Sometimes you will, but <i>familiar</i> does not mean <i>identical</i>.</p>
<p>The next time you see yourself looking for that C++ or Java feature that D doesn&#8217;t have, ask yourself which hat you are wearing. When you have the D hat on, most of the time you&#8217;ll find that you just don&#8217;t need that feature at all.</p>
<p>Technorati Tags: <a href="http://technorati.com/tag/D%20Programming%20Language" rel="tag">D Programming Language</a>, <a href="http://technorati.com/tag/C++" rel="tag">C++</a>, <a href="http://technorati.com/tag/Java" rel="tag">Java</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dblog.aldacron.net/2006/09/15/d-is-neither-c-nor-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

