<?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.post8531744484493050815..comments</id><updated>2009-11-24T13:17:53.179-08:00</updated><title type='text'>Comments on Programming and Debugging (in my Underhøøsen): Strumming Strings In the D Chord</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://the-free-meme.blogspot.com/feeds/8531744484493050815/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/8531744484493050815/comments/default'/><link rel='alternate' type='text/html' href='http://the-free-meme.blogspot.com/2009/03/strumming-strings-in-d-chord.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-3905677600017085932</id><published>2009-03-22T12:30:00.000-07:00</published><updated>2009-03-22T12:30:00.000-07:00</updated><title type='text'>Anonymous, here's the crux of the issue: in D, a s...</title><content type='html'>Anonymous, here's the crux of the issue: in D, a string is an array; arrays and slices can also be used interchangeably. &lt;BR/&gt;&lt;BR/&gt;In .net System.String, System.Array and the generic System.ArraySegment are three different types. So, if I want to take a slice of a string in D/.NET (assuming strings implemented as System.String) I would need two conversions: from string to array of System.Char, and from that to ArraySegment.&lt;BR/&gt;&lt;BR/&gt;Consider this (contrived, I agree) example:&lt;BR/&gt;void foo(string a) &lt;BR/&gt;{&lt;BR/&gt;    cast(char)(a [0]) = 'W';&lt;BR/&gt;}&lt;BR/&gt;void main()&lt;BR/&gt;{&lt;BR/&gt;    string s = "hello world";&lt;BR/&gt;    foo(s[6..$]);&lt;BR/&gt;//...&lt;BR/&gt;    assert(s[6] == 'W');&lt;BR/&gt;}&lt;BR/&gt;The generated code to make this work is quite complicated and very inefficient (again, assuming string === System.String). With strings implemented as unsigned int8[] arrays generating the code is quite straight forward.&lt;BR/&gt;&lt;BR/&gt;I think that I found a good compromise so far... We'll see how well this works "in the field" once I release it :)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/8531744484493050815/comments/default/3905677600017085932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/8531744484493050815/comments/default/3905677600017085932'/><link rel='alternate' type='text/html' href='http://the-free-meme.blogspot.com/2009/03/strumming-strings-in-d-chord.html?showComment=1237750200000#c3905677600017085932' 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/strumming-strings-in-d-chord.html' ref='tag:blogger.com,1999:blog-18241482.post-8531744484493050815' source='http://www.blogger.com/feeds/18241482/posts/default/8531744484493050815' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-18241482.post-6465809431645723582</id><published>2009-03-22T01:54:00.000-07:00</published><updated>2009-03-22T01:54:00.000-07:00</updated><title type='text'>Do you mean, programmer could carefully count non-...</title><content type='html'>Do you mean, programmer could carefully count non-english utf8 char lengths for slices? I doubt someone did this. Isn't it better to change specs a little than coping with full compatibility? Do you plan full compatibility? I think, some features should change, since .net way is quite different from D way. Well... if you hope D.net will outperform other .net dialects introducins D way into .net... hmm... it will be interesting.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/8531744484493050815/comments/default/6465809431645723582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/8531744484493050815/comments/default/6465809431645723582'/><link rel='alternate' type='text/html' href='http://the-free-meme.blogspot.com/2009/03/strumming-strings-in-d-chord.html?showComment=1237712040000#c6465809431645723582' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://the-free-meme.blogspot.com/2009/03/strumming-strings-in-d-chord.html' ref='tag:blogger.com,1999:blog-18241482.post-8531744484493050815' source='http://www.blogger.com/feeds/18241482/posts/default/8531744484493050815' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-18241482.post-6868493620213104205</id><published>2009-03-18T10:14:00.000-07:00</published><updated>2009-03-18T10:14:00.000-07:00</updated><title type='text'>Hi Anonymous, I tried using System.String by defau...</title><content type='html'>Hi Anonymous, I tried using System.String by default like you are suggesting but I found it very difficult to get string slices to work right.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/8531744484493050815/comments/default/6868493620213104205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/8531744484493050815/comments/default/6868493620213104205'/><link rel='alternate' type='text/html' href='http://the-free-meme.blogspot.com/2009/03/strumming-strings-in-d-chord.html?showComment=1237396440000#c6868493620213104205' 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/strumming-strings-in-d-chord.html' ref='tag:blogger.com,1999:blog-18241482.post-8531744484493050815' source='http://www.blogger.com/feeds/18241482/posts/default/8531744484493050815' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-18241482.post-2034645962637444793</id><published>2009-03-18T02:54:00.000-07:00</published><updated>2009-03-18T02:54:00.000-07:00</updated><title type='text'>I think, you should use native System.String more ...</title><content type='html'>I think, you should use native System.String more aggressively and convert strings to utf8 when and only when it's really needed, e.g. on casting to other pointer types, pinvoke etc.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/8531744484493050815/comments/default/2034645962637444793'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18241482/8531744484493050815/comments/default/2034645962637444793'/><link rel='alternate' type='text/html' href='http://the-free-meme.blogspot.com/2009/03/strumming-strings-in-d-chord.html?showComment=1237370040000#c2034645962637444793' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://the-free-meme.blogspot.com/2009/03/strumming-strings-in-d-chord.html' ref='tag:blogger.com,1999:blog-18241482.post-8531744484493050815' source='http://www.blogger.com/feeds/18241482/posts/default/8531744484493050815' type='text/html'/></entry></feed>