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-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 whatevers.

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 time.

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 arrays

Re: std.container update

2010-05-28 Thread Steven Schveighoffer
On Fri, 28 May 2010 07:58:55 -0400, Jonathan M Davis jmdavisp...@gmail.com 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,

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

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 seewebsiteforem...@erdani.org 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

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 schvei...@yahoo.com wrote: On Thu, 27 May 2010 21:08:29 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a

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 seewebsiteforem...@erdani.org 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

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 seewebsiteforem...@erdani.org wrote: On 05/28/2010 02:51 PM, Steven Schveighoffer wrote: On Thu, 27 May 2010 21:08:29 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: http://erdani.com/d/phobos/std_container.html

Re: std.container update

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 00:36:24 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org 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

Re: std.container update

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

Re: std.container update

2010-05-27 Thread Steven Schveighoffer
On Thu, 27 May 2010 09:27:39 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Thu, 27 May 2010 09:23:03 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Thu, 27 May 2010 00:36:24 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org 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 seewebsiteforem...@erdani.org 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

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 seewebsiteforem...@erdani.org

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 it.

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 [...]

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

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

Re: std.container update

2010-05-27 Thread Simen kjaeraas
Jonathan M Davis jmdavisp...@gmail.com 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

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

std.container update - now Array is in

2010-05-27 Thread Andrei Alexandrescu
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 believe it's becoming possible to write certain

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 it

Re: std.container update - now Array is in

2010-05-27 Thread Michel Fortin
On 2010-05-27 21:08:29 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org 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

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 seewebsiteforem...@erdani.org 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

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

std.container update

2010-05-26 Thread Andrei Alexandrescu
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 with Take. More details are to be found in code, but essentially SList