Re: std.container update - now Array is in

2010-05-28 Thread Steven Schveighoffer
On Fri, 28 May 2010 16:03:10 -0400, Andrei Alexandrescu wrote: On 05/28/2010 02:51 PM, Steven Schveighoffer wrote: On Thu, 27 May 2010 21:08:29 -0400, Andrei Alexandrescu wrote: http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a str

Re: std.container update - now Array is in

2010-05-28 Thread Andrei Alexandrescu
On 05/28/2010 02:51 PM, Steven Schveighoffer wrote: On Thu, 27 May 2010 21:08:29 -0400, Andrei Alexandrescu wrote: http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym abstraction. There are a

Re: std.container update - now Array is in

2010-05-28 Thread Steven Schveighoffer
On Fri, 28 May 2010 15:51:53 -0400, Steven Schveighoffer wrote: On Thu, 27 May 2010 21:08:29 -0400, Andrei Alexandrescu wrote: http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym abstr

Re: std.container update - now Array is in

2010-05-28 Thread Steven Schveighoffer
On Thu, 27 May 2010 21:08:29 -0400, Andrei Alexandrescu wrote: http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym abstraction. There are a few imperfect corners, but by and large I'm sta

Re: std.container update - now Array is in

2010-05-28 Thread Pillsy
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article: > I defined Array as a straightforward implementation of the > homonym abstraction. There are a few imperfect corners, but > by and large I'm starting to believe it's becoming possible > to write certain cross-container c

Re: std.container update

2010-05-28 Thread Steven Schveighoffer
On Fri, 28 May 2010 07:58:55 -0400, Jonathan M Davis wrote: BTW, what would be the point of an array/vector when you have built-in arrays? If built-in arrays would be syntax sugar for a real library type, like AAs, I can see as a good option using Array for that type, since built-in arrays

Re: std.container update

2010-05-28 Thread Leandro Lucarella
Jonathan M Davis, el 28 de mayo a las 04:58 me escribiste: > > BTW, what would be the point of an array/vector when you have built-in > > arrays? If built-in arrays would be syntax sugar for a real library type, > > like AAs, I can see as a good option using Array for that type, since > > built-in

Re: std.container update

2010-05-28 Thread bearophile
Jonathan M Davis: > The biggest difference is that a vector has capacity separate from its > size/length. You can efficiency insert elements at the end with a vector - > amortized constant time usually - but you can't do that with a built-in > array because it would have to reallocate every tim

Re: std.container update

2010-05-28 Thread Jonathan M Davis
Simen kjaeraas wrote: > I take it you don't work in simulation or games, then? Don't do much > linear algebra? > > While I understand the reasoning for it, I dislike the name vector for > arrays. A vector to me, is a geometric object with a length and magnitude, > not a random collection of whatev

Re: std.container update

2010-05-28 Thread Jonathan M Davis
> BTW, what would be the point of an array/vector when you have built-in > arrays? If built-in arrays would be syntax sugar for a real library type, > like AAs, I can see as a good option using Array for that type, since > built-in arrays and the library Array would be the same thing. The biggest

Re: std.container update

2010-05-27 Thread Andrei Alexandrescu
On 05/27/2010 08:42 PM, Leandro Lucarella wrote: Andrei Alexandrescu, el 27 de mayo a las 20:06 me escribiste: On 05/27/2010 06:28 PM, Jonathan M Davis wrote: I take it that Array is basically supposed to be std.container's version of C++'s vector or Java's ArrayList? If so, I would suggest tha

Re: std.container update - now Array is in

2010-05-27 Thread Andrei Alexandrescu
On 05/27/2010 09:27 PM, Michel Fortin wrote: On 2010-05-27 21:08:29 -0400, Andrei Alexandrescu said: http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym abstraction. There are a few imperfect

Re: std.container update - now Array is in

2010-05-27 Thread Michel Fortin
On 2010-05-27 21:08:29 -0400, Andrei Alexandrescu said: http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym abstraction. There are a few imperfect corners, but by and large I'm starting to b

Re: std.container update

2010-05-27 Thread Leandro Lucarella
Andrei Alexandrescu, el 27 de mayo a las 20:06 me escribiste: > On 05/27/2010 06:28 PM, Jonathan M Davis wrote: > >I take it that Array is basically supposed to be std.container's version of > >C++'s vector or Java's ArrayList? If so, I would suggest that Array is not > >the best of names in that i

Re: std.container update

2010-05-27 Thread Andrei Alexandrescu
On 05/27/2010 06:28 PM, Jonathan M Davis wrote: I take it that Array is basically supposed to be std.container's version of C++'s vector or Java's ArrayList? If so, I would suggest that Array is not the best of names in that it would become very easy to confuse it with built-in arrays when discus

Re: std.container update

2010-05-27 Thread Simen kjaeraas
Jonathan M Davis wrote: wouldn't be confused with anything else. If you really want Array, that's Personally, I would have just gone with Vector, since it's a fairly standard name for that sort of container and wouldn't be confused with anything else. I take it you don't work in simulation or

Re: std.container update

2010-05-27 Thread Jonathan M Davis
I take it that Array is basically supposed to be std.container's version of C++'s vector or Java's ArrayList? If so, I would suggest that Array is not the best of names in that it would become very easy to confuse it with built-in arrays when discussing them (particularly in verbal communication

Re: std.container update

2010-05-27 Thread Andrei Alexandrescu
Another update: http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I simplified the implementation (no more array allocation etc.), eliminated replace() and insertBefore() after convincing myself they are not a good fit for lists, and added linearRemove(Take!R

Re: std.container update

2010-05-27 Thread Andrei Alexandrescu
On 05/27/2010 11:01 AM, Pillsy wrote: == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article: I just implemented a singly-linked list type to illustrate the container abstraction. http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d [...] Pl

Re: std.container update

2010-05-27 Thread Pillsy
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article: > I just implemented a singly-linked list type to illustrate > the container abstraction. > http://erdani.com/d/phobos/std_container.html > http://erdani.com/d/phobos/container.d [...] > Please let me know of how you find

Re: std.container update

2010-05-27 Thread Andrei Alexandrescu
On 05/27/2010 08:23 AM, Steven Schveighoffer wrote: You're making a number of great points in the four posts starting with this. Since they sort of augment one another, let me quote and answer them all here. On Thu, 27 May 2010 00:36:24 -0400, Andrei Alexandrescu wrote: I just implemented a

Re: std.container update

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 00:36:24 -0400, Andrei Alexandrescu wrote: I just implemented a singly-linked list type to illustrate the container abstraction. http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d One interesting aspect is that SList must cooperate wit

Re: std.container update

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 09:27:39 -0400, Steven Schveighoffer wrote: On Thu, 27 May 2010 09:23:03 -0400, Steven Schveighoffer wrote: On Thu, 27 May 2010 00:36:24 -0400, Andrei Alexandrescu wrote: I just implemented a singly-linked list type to illustrate the container abstraction. htt

Re: std.container update

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 09:23:03 -0400, Steven Schveighoffer wrote: On Thu, 27 May 2010 00:36:24 -0400, Andrei Alexandrescu wrote: I just implemented a singly-linked list type to illustrate the container abstraction. http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos

Re: std.container update

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 00:36:24 -0400, Andrei Alexandrescu wrote: I just implemented a singly-linked list type to illustrate the container abstraction. http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d One interesting aspect is that SList must cooperate wit