Re: [Article Contest, first draft] D Slices

2011-05-23 Thread Steven Schveighoffer
On Sun, 22 May 2011 22:46:13 -0400, Jonathan M Davis wrote: On 2011-05-18 11:03, Steven Schveighoffer wrote: Having seen quite a few incorrect descriptions of how D slices work (particularly regarding appending), I wrote an article that tries to describe how D slices work, and why they behav

Re: [Article Contest, first draft] D Slices

2011-05-22 Thread Jonathan M Davis
On 2011-05-18 11:03, Steven Schveighoffer wrote: > Having seen quite a few incorrect descriptions of how D slices work > (particularly regarding appending), I wrote an article that tries to > describe how D slices work, and why they behave the way they do. > > Being one of the only places where I

Re: [Article Contest, first draft] D Slices

2011-05-22 Thread Steven Schveighoffer
On Fri, 20 May 2011 13:57:15 -0400, Andrei Alexandrescu wrote: On 5/20/11 12:55 PM, Jens Mueller wrote: Steven Schveighoffer wrote: Having seen quite a few incorrect descriptions of how D slices work (particularly regarding appending), I wrote an article that tries to describe how D slices

Re: [Article Contest, first draft] D Slices

2011-05-20 Thread Andrei Alexandrescu
On 5/20/11 12:55 PM, Jens Mueller wrote: Steven Schveighoffer wrote: Having seen quite a few incorrect descriptions of how D slices work (particularly regarding appending), I wrote an article that tries to describe how D slices work, and why they behave the way they do. Being one of the only pl

Re: [Article Contest, first draft] D Slices

2011-05-20 Thread Jens Mueller
Steven Schveighoffer wrote: > Having seen quite a few incorrect descriptions of how D slices work > (particularly regarding appending), I wrote an article that tries to > describe how D slices work, and why they behave the way they do. > > Being one of the only places where I have web space, it's

Re: [Article Contest, first draft] D Slices

2011-05-19 Thread Steven Schveighoffer
On Thu, 19 May 2011 00:27:51 -0400, Jonathan M Davis wrote: On 2011-05-18 21:09, Jesse Phillips wrote: Jonathan M Davis Wrote: > The huge advantage of assert over writeln is that it shows you what the > result is supposed to be. If you're reading the code or documentation, > that's extrem

Re: [Article Contest, first draft] D Slices

2011-05-19 Thread Steven Schveighoffer
On Thu, 19 May 2011 07:42:57 -0400, Lars T. Kyllingstad wrote: On Wed, 18 May 2011 14:03:05 -0400, Steven Schveighoffer wrote: Having seen quite a few incorrect descriptions of how D slices work (particularly regarding appending), I wrote an article that tries to describe how D slices work,

Re: [Article Contest, first draft] D Slices

2011-05-19 Thread Lars T. Kyllingstad
On Wed, 18 May 2011 14:03:05 -0400, Steven Schveighoffer wrote: > Having seen quite a few incorrect descriptions of how D slices work > (particularly regarding appending), I wrote an article that tries to > describe how D slices work, and why they behave the way they do. > > Being one of the only

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Jonathan M Davis
On 2011-05-18 21:09, Jesse Phillips wrote: > Jonathan M Davis Wrote: > > The huge advantage of assert over writeln is that it shows you what the > > result is supposed to be. If you're reading the code or documentation, > > that's extremely valuable, whereas writeln is useless. However, if what > >

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Jesse Phillips
Jonathan M Davis Wrote: > The huge advantage of assert over writeln is that it shows you what the > result > is supposed to be. If you're reading the code or documentation, that's > extremely valuable, whereas writeln is useless. However, if what you're > concerned about is running the code an

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Jonathan M Davis
> Steven Schveighoffer Wrote: > > I always wonder about that. One of the issues with assert for people > > "feeling" out the language is, a passing assert doesn't seem to do > > anything. > > > > For instance, in this example, if you take the code I wrote, and compile > > it, you'll get a loud ass

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Jesse Phillips
Steven Schveighoffer Wrote: > I always wonder about that. One of the issues with assert for people > "feeling" out the language is, a passing assert doesn't seem to do > anything. > > For instance, in this example, if you take the code I wrote, and compile > it, you'll get a loud assertion

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Johann MacDonagh
On 5/18/2011 2:03 PM, Steven Schveighoffer wrote: Having seen quite a few incorrect descriptions of how D slices work (particularly regarding appending), I wrote an article that tries to describe how D slices work, and why they behave the way they do. Being one of the only places where I have we

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Andrej Mitrovic
Asserts are kind of like going to court and interpreting the silence of the jury as a not guilty verdict. :p

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Steven Schveighoffer
On Wed, 18 May 2011 16:47:47 -0400, Alex_Dovhal wrote: Nice article, very pleasured to read. One thing that strained my mind - this exaple: import std.stdio; char[] fillAs(char[] buf, size_t num) { if(buf.length < num) buf.length = num; // increase buffer length to be able to hold

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Steven Schveighoffer
On Wed, 18 May 2011 16:37:49 -0400, Jesse Phillips wrote: Steven Schveighoffer Wrote: Having seen quite a few incorrect descriptions of how D slices work (particularly regarding appending), I wrote an article that tries to describe how D slices work, and why they behave the way they do. S

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Steven Schveighoffer
On Wed, 18 May 2011 16:22:50 -0400, Andrej Mitrovic wrote: Well consider me enlightened. From all the things I've read before this article, I thought a slice is a special feature that is only introduced when you take an [n..m] from an array, e.g. my understanding was something like: int[] a

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Alex_Dovhal
"Steven Schveighoffer" ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: news:op.vvou3fbgeav7ka@localhost.localdomain... > Having seen quite a few incorrect descriptions of how D slices work > (particularly regarding appending), I wrote an article that tries to > describe how D slices work, and why they

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Jesse Phillips
Steven Schveighoffer Wrote: > Having seen quite a few incorrect descriptions of how D slices work > (particularly regarding appending), I wrote an article that tries to > describe how D slices work, and why they behave the way they do. Still reading, but the example should use assertions whic

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Andrej Mitrovic
Well consider me enlightened. From all the things I've read before this article, I thought a slice is a special feature that is only introduced when you take an [n..m] from an array, e.g. my understanding was something like: int[] a = new int[5]; // a is definitely a dynamic array auto b = a[1..3

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Steven Schveighoffer
On Wed, 18 May 2011 14:44:33 -0400, David Gileadi wrote: I do have a couple of nits: Fixed -Steve

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Andrej Mitrovic
On 5/18/11, David Gileadi wrote: > There is at least one other place in the document that also make this mistake. The first sentence! :]

[Article Contest, first draft] D Slices

2011-05-18 Thread Steven Schveighoffer
Having seen quite a few incorrect descriptions of how D slices work (particularly regarding appending), I wrote an article that tries to describe how D slices work, and why they behave the way they do. Being one of the only places where I have web space, it's on my dcollections site, I prob

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread David Gileadi
On 5/18/11 11:03 AM, Steven Schveighoffer wrote: Please, if you have any comments or recommendations, let me know. First off, this is a fantastic article. Thanks for clearly explaining a fairly subtle concept. I'm especially happy to finally understand how appending to a slice can avoid rea

Re: [Article Contest, first draft] D Slices

2011-05-18 Thread Steven Schveighoffer
On Wed, 18 May 2011 14:44:33 -0400, David Gileadi wrote: On 5/18/11 11:03 AM, Steven Schveighoffer wrote: Please, if you have any comments or recommendations, let me know. First off, this is a fantastic article. Thanks for clearly explaining a fairly subtle concept. I'm especially happ