<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-18241482.post6315942529023484452..comments</id><updated>2009-03-25T12:08:51.591-07:00</updated><title type='text'>Comments on Programming and Debugging (in my Underhøøsen): Associative Arrays in D.NET</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://the-free-meme.blogspot.com/feeds/6315942529023484452/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/6315942529023484452/comments/default'/><link rel='alternate' type='text/html' href='http://the-free-meme.blogspot.com/2009/03/associate-arrays-in-dnet.html'/><author><name>The Free Meme</name><uri>http://www.blogger.com/profile/08287129746971472910</uri><email>cristi.vlasceanu@gmail.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-18241482.post-3501761970679607349</id><published>2009-03-25T12:08:00.000-07:00</published><updated>2009-03-25T12:08:00.000-07:00</updated><title type='text'>It was easier to go the helper / delegate way beca...</title><content type='html'>It was easier to go the helper / delegate way because the front-end (which I did not write) does the lambda-extract already. &lt;BR/&gt;&lt;BR/&gt;My first instinct when I sat down to implement foreach over associative arrays was exactly what you are suggesting -- but then I ran into the "foreach over opApply" language feature.&lt;BR/&gt;&lt;BR/&gt;As for the ordering question: I believe that if some code depends on a particular order of the elements in the associative array then something is wrong with the design, and a different data structure should be used. In C++ for example, if you needed the elements to be ordered you would use a map over a hash_map (which BTW in C++ox will be renamed to unordered_map, to make it unambiguous that one should not rely on any particular ordering).&lt;BR/&gt;&lt;BR/&gt;Feel free to email if you prefer that medium over the comment format.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/6315942529023484452/comments/default/3501761970679607349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/6315942529023484452/comments/default/3501761970679607349'/><link rel='alternate' type='text/html' href='http://the-free-meme.blogspot.com/2009/03/associate-arrays-in-dnet.html?showComment=1238008080000#c3501761970679607349' title=''/><author><name>The Free Meme</name><uri>http://www.blogger.com/profile/08287129746971472910</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05942387056293398693'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://the-free-meme.blogspot.com/2009/03/associate-arrays-in-dnet.html' ref='tag:blogger.com,1999:blog-18241482.post-6315942529023484452' source='http://www.blogger.com/feeds/18241482/posts/default/6315942529023484452' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-18241482.post-4550410447115988862</id><published>2009-03-25T11:36:00.000-07:00</published><updated>2009-03-25T11:36:00.000-07:00</updated><title type='text'>For the most part, I meant in your CIL emission ph...</title><content type='html'>For the most part, I meant in your CIL emission phase.  Rather than utilize a helper class which uses a lambda-extract (based upon how I&amp;#39;m guessing you call it, for it to properly maintain scope.  Though what I do know of D, sub-methods are simply a feature, so it was probably easy once that feature was implemented), you could have emitted CIL similar to how C# implements its for-each iterations on enumerable targets.  Replacing references of &amp;#39;key&amp;#39; and &amp;#39;value&amp;#39;, or whatever the named elements resolve to, with KeyValuePair&amp;lt;..., ...&amp;gt;.Key and ..Value respectively.   This should be pretty simple once you properly resolve all symbols, right?&lt;BR/&gt;&lt;BR/&gt;Also, couldn&amp;#39;t there be issues with alternative implementations of core constructs (ie. associative arrays)?  Especially when related to basic behavior, the code on two compilers would yield different functionality, ignoring the semantic differences between versions (such as version(D_NET)).  Such functional differences would make code confusing in cases where you use conditional compilation arguments, since one would think that the native compiler and the D_NET compiler would emit functionally equal code.  &lt;BR/&gt;&lt;BR/&gt;Certain predictability assumptions would be more difficult to make until you became fully aware of the differences between the versions maintained in the code (for example, the order in which elements in an associative array might be important in certain cases, it&amp;#39;s not related to a system feature either, so different functionality would be odd, to say the least).&lt;BR/&gt;&lt;BR/&gt;Naturally, I might be missing something, I stumbled upon your blog while reading about &amp;#39;D&amp;#39; from another link I received from someone else (so what I know about it is 5 minutes worth of reading, your blog was listed in a page about The Astoria Seminar).&lt;BR/&gt;&lt;BR/&gt;If there&amp;#39;s something I missed about D, implementing it, and so on, please clue me in (I&amp;#39;m interested in language design and implementation, code generation, and so on).</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/6315942529023484452/comments/default/4550410447115988862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/6315942529023484452/comments/default/4550410447115988862'/><link rel='alternate' type='text/html' href='http://the-free-meme.blogspot.com/2009/03/associate-arrays-in-dnet.html?showComment=1238006160000#c4550410447115988862' title=''/><author><name>Alexander</name><uri>http://www.blogger.com/profile/05269018823666569680</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11400050770513321197'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://the-free-meme.blogspot.com/2009/03/associate-arrays-in-dnet.html' ref='tag:blogger.com,1999:blog-18241482.post-6315942529023484452' source='http://www.blogger.com/feeds/18241482/posts/default/6315942529023484452' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-18241482.post-3183662866166133008</id><published>2009-03-25T10:35:00.000-07:00</published><updated>2009-03-25T10:35:00.000-07:00</updated><title type='text'>Good observation. The order is implementation-depe...</title><content type='html'>Good observation. The order is implementation-dependent: &lt;BR/&gt;&lt;BR/&gt;In D.NET the associative array is a generic Dictionary while the native D compiler rolls its own hash container under the wraps. &lt;BR/&gt;&lt;BR/&gt;The D language spec leaves the implementation of associative arrays up to the compiler.&lt;BR/&gt;&lt;BR/&gt;Throwing an exception from the iteration loop does not break the internals of the array, if that's what you meant.&lt;BR/&gt;&lt;BR/&gt;The transactional flavor was unintentional, and it is easy to eliminate. I am not sure that I understand what you mean by "forgo a transformation on the foreach iteration of the associative array".</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/6315942529023484452/comments/default/3183662866166133008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/6315942529023484452/comments/default/3183662866166133008'/><link rel='alternate' type='text/html' href='http://the-free-meme.blogspot.com/2009/03/associate-arrays-in-dnet.html?showComment=1238002500000#c3183662866166133008' title=''/><author><name>The Free Meme</name><uri>http://www.blogger.com/profile/08287129746971472910</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='05942387056293398693'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://the-free-meme.blogspot.com/2009/03/associate-arrays-in-dnet.html' ref='tag:blogger.com,1999:blog-18241482.post-6315942529023484452' source='http://www.blogger.com/feeds/18241482/posts/default/6315942529023484452' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-18241482.post-4541542975360489296</id><published>2009-03-25T08:29:00.000-07:00</published><updated>2009-03-25T08:29:00.000-07:00</updated><title type='text'>object.Exception: kaboomtwo, 0three, 3one, 1Just c...</title><content type='html'>&lt;I&gt;object.Exception: kaboom&lt;BR/&gt;two, 0&lt;BR/&gt;three, 3&lt;BR/&gt;one, 1&lt;/I&gt;&lt;BR/&gt;&lt;BR/&gt;Just curious, I'm not overly familiar with D; however, if the entire set was iterated over, what determines the order?  From the example above, you defined the elements in a different order (ala: &lt;I&gt;int [string] x = ["two" : 2, "three" : 3, "one" : 1];&lt;/I&gt;) from the example provided.  Just noticed by the fact that "one":1 was still 1.&lt;BR/&gt;&lt;BR/&gt;If you didn't use a different set of code, could the exception be de-synchronizing the associative array (based upon the underlying implementation, of course)?  I'm probably over-thinking this.&lt;BR/&gt;&lt;BR/&gt;On a side note, why did you forgo a transformation on the foreach iteration of the associative array?  Wouldn't it be easier, were you to omit the transactional flavor, to emit the proper CIL to handle a C#-ish foreach block (to get proper code flow on exceptions)?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/6315942529023484452/comments/default/4541542975360489296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/6315942529023484452/comments/default/4541542975360489296'/><link rel='alternate' type='text/html' href='http://the-free-meme.blogspot.com/2009/03/associate-arrays-in-dnet.html?showComment=1237994940000#c4541542975360489296' title=''/><author><name>Alexander</name><uri>http://www.blogger.com/profile/05269018823666569680</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11400050770513321197'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://the-free-meme.blogspot.com/2009/03/associate-arrays-in-dnet.html' ref='tag:blogger.com,1999:blog-18241482.post-6315942529023484452' source='http://www.blogger.com/feeds/18241482/posts/default/6315942529023484452' type='text/html'/></entry></feed>