Re: Kinds of containers

2015-10-26 Thread rsw0x via Digitalmars-d
On Monday, 26 October 2015 at 19:31:26 UTC, Ulrich Küttler wrote: On Wednesday, 21 October 2015 at 18:49:26 UTC, Andrei Alexandrescu wrote: On 10/21/2015 12:25 PM, Jonathan M Davis wrote: My experience with immutable containers is that their performance is trash precisely because you can't

Re: Kinds of containers

2015-10-26 Thread Ulrich Küttler via Digitalmars-d
On Wednesday, 21 October 2015 at 18:49:26 UTC, Andrei Alexandrescu wrote: On 10/21/2015 12:25 PM, Jonathan M Davis wrote: My experience with immutable containers is that their performance is trash precisely because you can't mutate them. That's actually the experience in the Scala community.

Re: Kinds of containers

2015-10-26 Thread lobo via Digitalmars-d
On Monday, 26 October 2015 at 19:31:26 UTC, Ulrich Küttler wrote: On Wednesday, 21 October 2015 at 18:49:26 UTC, Andrei Alexandrescu wrote: On 10/21/2015 12:25 PM, Jonathan M Davis wrote: My experience with immutable containers is that their performance is trash precisely because you can't

Re: Kinds of containers

2015-10-26 Thread Timon Gehr via Digitalmars-d
On 10/26/2015 08:31 PM, Ulrich Küttler wrote: On Wednesday, 21 October 2015 at 18:49:26 UTC, Andrei Alexandrescu wrote: On 10/21/2015 12:25 PM, Jonathan M Davis wrote: My experience with immutable containers is that their performance is trash precisely because you can't mutate them. That's

Re: Kinds of containers

2015-10-26 Thread Ulrich Küttler via Digitalmars-d
On Monday, 26 October 2015 at 20:46:21 UTC, Timon Gehr wrote: On 10/26/2015 08:31 PM, Ulrich Küttler wrote: On Wednesday, 21 October 2015 at 18:49:26 UTC, Andrei Alexandrescu wrote: On 10/21/2015 12:25 PM, Jonathan M Davis wrote: My experience with immutable containers is that their

Re: Kinds of containers

2015-10-25 Thread Jonathan M Davis via Digitalmars-d
On Sunday, 25 October 2015 at 05:37:02 UTC, deadalnix wrote: On Saturday, 24 October 2015 at 19:33:03 UTC, David Nadlinger wrote: On Friday, 23 October 2015 at 17:44:55 UTC, deadalnix wrote: Collection!T and Collection!const(T) are 2 completely different types. Isn't this also required

Re: Kinds of containers

2015-10-25 Thread Jonathan M Davis via Digitalmars-d
On Sunday, 25 October 2015 at 15:42:02 UTC, Andrei Alexandrescu wrote: Jonathan, do you have a link to your work? Sorry, but no. I haven't mucked around with this issue recently, and whatever I have left on the topic is either buried in a newsgroup post somewhere or buried on my hard drive

Re: Kinds of containers

2015-10-25 Thread Timon Gehr via Digitalmars-d
On 10/25/2015 08:33 PM, Andrei Alexandrescu wrote: On 10/24/2015 07:03 PM, Timon Gehr wrote: On 10/24/2015 09:22 PM, Andrei Alexandrescu wrote: On 10/24/15 3:19 PM, Timon Gehr wrote: Even if this was possible, it would not be a very good idea. Persistent data structures have use cases that

Re: Kinds of containers

2015-10-25 Thread Timon Gehr via Digitalmars-d
On 10/25/2015 08:31 PM, Andrei Alexandrescu wrote: On 10/23/2015 07:21 PM, bigsandwich wrote: On Friday, 23 October 2015 at 17:44:55 UTC, deadalnix wrote: On Friday, 23 October 2015 at 11:03:37 UTC, Andrei Alexandrescu wrote: [...] Sure. We have a problem when it come to collection in the

Re: Kinds of containers

2015-10-25 Thread Andrei Alexandrescu via Digitalmars-d
On 10/25/2015 05:06 PM, Timon Gehr wrote: class A{}; class B: A{}; int main(){ vector a; vector b; a=b; } However, the conversion would be safe. Agreed. I don't see that as an important matter though; it's after all a coercion so a function call is plenty fine. --

Re: Kinds of containers

2015-10-25 Thread Andrei Alexandrescu via Digitalmars-d
On 10/23/2015 01:44 PM, deadalnix wrote: On Friday, 23 October 2015 at 11:03:37 UTC, Andrei Alexandrescu wrote: On 10/22/15 1:09 AM, deadalnix wrote: The elephant in the room: make the template parameter's type qualifier transitive with the collection's qualifier. Could you please give more

Re: Kinds of containers

2015-10-25 Thread Andrei Alexandrescu via Digitalmars-d
On 10/24/2015 07:03 PM, Timon Gehr wrote: On 10/24/2015 09:22 PM, Andrei Alexandrescu wrote: On 10/24/15 3:19 PM, Timon Gehr wrote: Even if this was possible, it would not be a very good idea. Persistent data structures have use cases that would be hindered by required transitive immutability.

Re: Kinds of containers

2015-10-25 Thread Andrei Alexandrescu via Digitalmars-d
On 10/23/2015 07:21 PM, bigsandwich wrote: On Friday, 23 October 2015 at 17:44:55 UTC, deadalnix wrote: On Friday, 23 October 2015 at 11:03:37 UTC, Andrei Alexandrescu wrote: [...] Sure. We have a problem when it come to collection in the fact that type qualifier do not turtle down as one

Re: Kinds of containers

2015-10-24 Thread TheFlyingFiddle via Digitalmars-d
On Saturday, 24 October 2015 at 09:22:37 UTC, Jacob Carlborg wrote: Can these be implemented by the user just declaring a regular container as immutable? The implement will recognize if it's declared as immutable and adapt. How can a type know it's qualifier? struct Container(T) { //

Re: Kinds of containers

2015-10-24 Thread Kagamin via Digitalmars-d
On Friday, 23 October 2015 at 17:44:55 UTC, deadalnix wrote: void foo(T)(const Collection!const(T) c) {} void main() { Collection!T c; foo(c); // Error, GTFO ! } How about this? void f(T)(const Collection!T c) { const Collection!(Unqual!T) cc = c; }

Re: Kinds of containers

2015-10-24 Thread Andrei Alexandrescu via Digitalmars-d
On 10/24/15 3:19 PM, Timon Gehr wrote: Even if this was possible, it would not be a very good idea. Persistent data structures have use cases that would be hindered by required transitive immutability. This part I don't quite get. Are there any languages that offer containers with immutable

Re: Kinds of containers

2015-10-24 Thread Timon Gehr via Digitalmars-d
On 10/24/2015 09:33 PM, David Nadlinger wrote: On Friday, 23 October 2015 at 17:44:55 UTC, deadalnix wrote: Collection!T and Collection!const(T) are 2 completely different types. Isn't this also required anyway because of covariance vs. contravariance considerations? — David (I'm

Re: Kinds of containers

2015-10-24 Thread Timon Gehr via Digitalmars-d
On 10/24/2015 09:22 PM, Andrei Alexandrescu wrote: On 10/24/15 3:19 PM, Timon Gehr wrote: Even if this was possible, it would not be a very good idea. Persistent data structures have use cases that would be hindered by required transitive immutability. This part I don't quite get. The slots

Re: Kinds of containers

2015-10-24 Thread Timon Gehr via Digitalmars-d
On 10/24/2015 11:22 AM, Jacob Carlborg wrote: On 2015-10-21 13:05, Andrei Alexandrescu wrote: 1. Functional containers. These are immutable; once created, neither their topology nor their elements may be observably changed. Manipulating a container entails creating an entire new container,

Re: Kinds of containers

2015-10-24 Thread David Nadlinger via Digitalmars-d
On Friday, 23 October 2015 at 17:44:55 UTC, deadalnix wrote: Collection!T and Collection!const(T) are 2 completely different types. Isn't this also required anyway because of covariance vs. contravariance considerations? — David

Re: Kinds of containers

2015-10-24 Thread deadalnix via Digitalmars-d
On Saturday, 24 October 2015 at 19:33:03 UTC, David Nadlinger wrote: On Friday, 23 October 2015 at 17:44:55 UTC, deadalnix wrote: Collection!T and Collection!const(T) are 2 completely different types. Isn't this also required anyway because of covariance vs. contravariance considerations?

Re: Kinds of containers

2015-10-24 Thread Jacob Carlborg via Digitalmars-d
On 2015-10-21 13:05, Andrei Alexandrescu wrote: 1. Functional containers. These are immutable; once created, neither their topology nor their elements may be observably changed. Manipulating a container entails creating an entire new container, often based on an existing container (e.g. append

Re: Kinds of containers

2015-10-24 Thread Timon Gehr via Digitalmars-d
On 10/24/2015 01:36 AM, bitwise wrote: On Friday, 23 October 2015 at 23:21:31 UTC, bigsandwich wrote: On Friday, 23 October 2015 at 17:44:55 UTC, deadalnix wrote: On Friday, 23 October 2015 at 11:03:37 UTC, Andrei Alexandrescu wrote: [...] Sure. We have a problem when it come to collection

Re: Kinds of containers

2015-10-23 Thread Andrei Alexandrescu via Digitalmars-d
On 10/22/15 1:09 AM, deadalnix wrote: The elephant in the room: make the template parameter's type qualifier transitive with the collection's qualifier. Could you please give more detail on this? Thanks! -- Andrei

Re: Kinds of containers

2015-10-23 Thread deadalnix via Digitalmars-d
On Friday, 23 October 2015 at 11:03:37 UTC, Andrei Alexandrescu wrote: On 10/22/15 1:09 AM, deadalnix wrote: The elephant in the room: make the template parameter's type qualifier transitive with the collection's qualifier. Could you please give more detail on this? Thanks! -- Andrei Sure.

Re: Kinds of containers

2015-10-23 Thread bigsandwich via Digitalmars-d
On Friday, 23 October 2015 at 17:44:55 UTC, deadalnix wrote: On Friday, 23 October 2015 at 11:03:37 UTC, Andrei Alexandrescu wrote: [...] Sure. We have a problem when it come to collection in the fact that type qualifier do not turtle down as one would expect. [...] Its not just type

Re: Kinds of containers

2015-10-23 Thread bitwise via Digitalmars-d
On Friday, 23 October 2015 at 23:21:31 UTC, bigsandwich wrote: On Friday, 23 October 2015 at 17:44:55 UTC, deadalnix wrote: On Friday, 23 October 2015 at 11:03:37 UTC, Andrei Alexandrescu wrote: [...] Sure. We have a problem when it come to collection in the fact that type qualifier do not

Re: Kinds of containers

2015-10-23 Thread bitwise via Digitalmars-d
On Friday, 23 October 2015 at 17:44:55 UTC, deadalnix wrote: Sure. We have a problem when it come to collection in the fact that type qualifier do not turtle down as one would expect. Collection!T and Collection!const(T) are 2 completely different types. There is a good reason for this :

Re: Kinds of containers

2015-10-22 Thread Dmitry Olshansky via Digitalmars-d
On 21-Oct-2015 19:13, Ola Fosheim Grøstad wrote: 5. Lock-free data structures. More generally - concurrent. It may have fine-grained locking, it may be obstruction-free or even wait-free. -- Dmitry Olshansky

Re: Kinds of containers

2015-10-22 Thread Nordlöw via Digitalmars-d
On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei Alexandrescu wrote: Andrei Exiting, times ahead! One thing that has caught my attention lately: I believe one way of making `std.experimental.allocator` usage (more) automatic is to add subtypes of containers for specific limited access

Re: Kinds of containers

2015-10-22 Thread KlausO via Digitalmars-d
Am 22.10.2015 um 00:15 schrieb Zz: On Wednesday, 21 October 2015 at 22:12:32 UTC, Zz wrote: On Wednesday, 21 October 2015 at 19:17:52 UTC, Andrei Alexandrescu wrote: On 10/21/2015 02:18 PM, Zz wrote: While looking at containers take a look at Jiri Soukup's work some good ideas could come

Re: Kinds of containers

2015-10-22 Thread Nordlöw via Digitalmars-d
On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei Alexandrescu wrote: Internally, functional containers take advantage of common substructure and immutability to share actual data. The classic resource for defining and implementing functional containers is

Re: Kinds of containers

2015-10-22 Thread Jonathan M Davis via Digitalmars-d
On Thursday, 22 October 2015 at 16:29:19 UTC, bitwise wrote: Maybe look at the code next time before you LOL.. My point would be the same regardless. Range!(const T) and const(Range!T) - and Container!(const T) and const(Container!T) - have no relation as far as the compiler is

Re: Kinds of containers

2015-10-22 Thread bitwise via Digitalmars-d
On Thursday, 22 October 2015 at 17:13:48 UTC, Jonathan M Davis wrote: On Thursday, 22 October 2015 at 16:29:19 UTC, bitwise wrote: Maybe look at the code next time before you LOL.. My point would be the same regardless. Range!(const T) and const(Range!T) - and Container!(const T) and

Re: Kinds of containers

2015-10-22 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, 21 October 2015 at 20:06:41 UTC, Andrei Alexandrescu wrote: On 10/21/2015 03:38 PM, Jonathan M Davis wrote: On Wednesday, 21 October 2015 at 19:19:23 UTC, Andrei Alexandrescu wrote: I'd say let's first have a Pope before becoming more Catholic than him. -- Andrei I confess

Re: Kinds of containers

2015-10-22 Thread Andrei Alexandrescu via Digitalmars-d
On 10/22/2015 03:39 AM, Nordlöw wrote: On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei Alexandrescu wrote: Internally, functional containers take advantage of common substructure and immutability to share actual data. The classic resource for defining and implementing functional

Re: Kinds of containers

2015-10-22 Thread safety0ff via Digitalmars-d
On Thursday, 22 October 2015 at 07:13:58 UTC, KlausO wrote: Intrusive data structures have their strengths especially when nodes are part of several containers. I implemented some of the intrusive containers back in D1 times. See

Re: Kinds of containers

2015-10-22 Thread safety0ff via Digitalmars-d
On Thursday, 22 October 2015 at 14:14:09 UTC, safety0ff wrote: I also like having an intrusive container library in my toolbox: they don't limit membership to one container and they don't "bake" memory management into the container type. Also wanted to mention that this allows you to

Re: Kinds of containers

2015-10-22 Thread Kagamin via Digitalmars-d
On Wednesday, 21 October 2015 at 16:25:19 UTC, Jonathan M Davis wrote: My experience with immutable containers is that their performance is trash precisely because you can't mutate them. Well, in context of concurrency immutable containers compete with concurrent containers, not with mutable

Re: Kinds of containers

2015-10-22 Thread Russel Winder via Digitalmars-d
On Wed, 2015-10-21 at 14:49 -0400, Andrei Alexandrescu via Digitalmars- d wrote: > […] > That's actually the experience in the Scala community. Over and again > people start with immutable containers all over the place because > they're cool, and end up with mutable containers because they work.

Re: Kinds of containers

2015-10-22 Thread bitwise via Digitalmars-d
On Thursday, 22 October 2015 at 05:09:38 UTC, deadalnix wrote: On Thursday, 22 October 2015 at 02:13:12 UTC, bitwise wrote: I needed containers, so I implemented a few: https://github.com/bitwise-github/d-collections Currently included: List(T) - contiguous list like std::vector LinkedList(T)

Re: Kinds of containers

2015-10-22 Thread bitwise via Digitalmars-d
On Thursday, 22 October 2015 at 15:53:21 UTC, Jonathan M Davis wrote: On Thursday, 22 October 2015 at 15:26:30 UTC, bitwise wrote: On Thursday, 22 October 2015 at 05:09:38 UTC, deadalnix wrote: The elephant in the room: make the template parameter's type qualifier transitive with the

Re: Kinds of containers

2015-10-22 Thread Jonathan M Davis via Digitalmars-d
On Thursday, 22 October 2015 at 15:26:30 UTC, bitwise wrote: On Thursday, 22 October 2015 at 05:09:38 UTC, deadalnix wrote: The elephant in the room: make the template parameter's type qualifier transitive with the collection's qualifier. Not sure exactly what you mean by this. Currently,

Re: Kinds of containers

2015-10-21 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei Alexandrescu wrote: I'm finally getting the cycles to get to thinking about Design by Introspection containers. First off, there are several general categories of containers. I think D should support all properly. One question is which we

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 09:46 AM, Robert burner Schadek wrote: On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei Alexandrescu wrote: I'm finally getting the cycles to get to thinking about Design by Introspection containers. What do you have in mind about the Design by Introspection (DyI, DbI is

Re: Kinds of containers

2015-10-21 Thread Timon Gehr via Digitalmars-d
On 10/21/2015 01:05 PM, Andrei Alexandrescu wrote: I'm finally getting the cycles to get to thinking about Design by Introspection containers. First off, there are several general categories of containers. I think D should support all properly. One question is which we go for in the standard

Re: Kinds of containers

2015-10-21 Thread Robert burner Schadek via Digitalmars-d
On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei Alexandrescu wrote: I'm finally getting the cycles to get to thinking about Design by Introspection containers. What do you have in mind about the Design by Introspection (DyI, DbI is taken) for the container? How do you plan to use the

Re: Kinds of containers

2015-10-21 Thread Robert burner Schadek via Digitalmars-d
On Wednesday, 21 October 2015 at 14:20:23 UTC, Andrei Alexandrescu wrote: Containers will obey subsets of a nomenclature of primitives. Just to be crystal clear, something like this? void fun(Container)(ref Container c) if (hasAppend!Container) { // append stuff to c }

Re: Kinds of containers

2015-10-21 Thread Ice Cream Man via Digitalmars-d
On Wednesday, 21 October 2015 at 14:06:43 UTC, Jonathan M Davis wrote: 1. Functional containers. I fully expect that these have their place, but I honestly have no idea what they would be. When I've used functional languages, I've only ever found these attributes to be a royal pain to deal

Re: Kinds of containers

2015-10-21 Thread Timon Gehr via Digitalmars-d
On 10/21/2015 04:36 PM, Andrei Alexandrescu wrote: On 10/21/2015 10:21 AM, Timon Gehr wrote: I still think those should be mutable by default in order to have painless interchangeability with other value type containers. Why should corresponding ephemeral and persistent containers have

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 09:13 AM, Andrea Fontana wrote: On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei Alexandrescu wrote: I'll attempt to implement a few versions of each and see what they look like. The question here is what containers are of interest for D's standard library. Andrei Tree

Re: Kinds of containers

2015-10-21 Thread Timon Gehr via Digitalmars-d
On 10/21/2015 05:08 PM, Timon Gehr wrote: There would be no mutable aliasing. Here, I mean within the data structure itself. There is nothing wrong with: class Cell{ int x=0; } FunSet!Cell a; a.insert(new Cell()); auto b=a; foreach(c;a) c.x=1; assert(b.x==1); This is analogous to: struct

Re: Kinds of containers

2015-10-21 Thread Russel Winder via Digitalmars-d
On Wed, 2015-10-21 at 14:06 +, Jonathan M Davis via Digitalmars-d wrote: > […] > > 1. Functional containers. > > I fully expect that these have their place, but I honestly have > no idea what they would be. When I've used functional languages, > I've only ever found these attributes to be

Re: Kinds of containers

2015-10-21 Thread Ice Cream Man via Digitalmars-d
On Wednesday, 21 October 2015 at 16:25:19 UTC, Jonathan M Davis wrote: They're just too unwieldy and inefficient. - Jonathan M Davis Only if you don't know how to use them. They are very wieldy, efficient AND safe, if you do know how to swing the ax. Its all about learning to work with

Re: Kinds of containers

2015-10-21 Thread Ola Fosheim Grøstad via Digitalmars-d
5. Lock-free data structures.

Re: Kinds of containers

2015-10-21 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, 21 October 2015 at 15:34:14 UTC, Russel Winder wrote: On Wed, 2015-10-21 at 14:06 +, Jonathan M Davis via Digitalmars-d wrote: […] > 1. Functional containers. I fully expect that these have their place, but I honestly have no idea what they would be. When I've used

Re: Kinds of containers

2015-10-21 Thread Ice Cream Man via Digitalmars-d
On Wednesday, 21 October 2015 at 15:18:08 UTC, Ice Cream Man wrote: On Wednesday, 21 October 2015 at 14:06:43 UTC, Jonathan M Davis wrote: [...] I've found immutable containers useful when working with configuration files. There are only a few places in a program where you want to actively

Re: Pandas [was Kinds of containers]

2015-10-21 Thread Russel Winder via Digitalmars-d
On Wed, 2015-10-21 at 09:11 -0400, Andrei Alexandrescu via Digitalmars-d wrote: > […] > My finance folks also rave about Pandas. I wish I could fork myself to > look into it. Pandas is what makes Python a viable competitor to R. Most data science people will use one or the other these days.

Re: Kinds of containers

2015-10-21 Thread Timon Gehr via Digitalmars-d
On 10/21/2015 01:05 PM, Andrei Alexandrescu wrote: 2. Reference containers. These have classic reference semantics (à la Java). Internally, they may be implemented either as class objects or as reference counted structs. They're by default mutable. Qualifiers should apply to them gracefully.

Re: Kinds of containers

2015-10-21 Thread Ice Cream Man via Digitalmars-d
On Wednesday, 21 October 2015 at 15:34:14 UTC, Russel Winder wrote: On Wed, 2015-10-21 at 14:06 +, Jonathan M Davis via Digitalmars-d wrote: [...] […] [...] I am confused as to why you would find these functional/persistent data structures to be a problem in functional languages. The

Re: Kinds of containers

2015-10-21 Thread H. S. Teoh via Digitalmars-d
On Wed, Oct 21, 2015 at 09:11:38AM -0400, Andrei Alexandrescu via Digitalmars-d wrote: [...] > My finance folks also rave about Pandas. I wish I could fork myself to > look into it. [...] Unfortunately, forking a human process takes 9 months to spawn the new process (slow OS, y'know), and the

Re: Kinds of containers

2015-10-21 Thread Brad Anderson via Digitalmars-d
On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei Alexandrescu wrote: [snip] 2. Reference containers. These have classic reference semantics (à la Java). Internally, they may be implemented either as class objects or as reference counted structs. They're by default mutable. Qualifiers

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 10:21 AM, Timon Gehr wrote: I still think those should be mutable by default in order to have painless interchangeability with other value type containers. Why should corresponding ephemeral and persistent containers have different interfaces? I assume you envision code using

Re: Kinds of containers

2015-10-21 Thread Ulrich Kuettler via Digitalmars-d
On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei Alexandrescu wrote: I'm finally getting the cycles to get to thinking about Design by Introspection containers. First off, there are several general categories of containers. I think D should support all properly. One question is which we

Re: Kinds of containers

2015-10-21 Thread Timon Gehr via Digitalmars-d
On 10/21/2015 06:25 PM, Jonathan M Davis wrote: My experience with immutable containers is that their performance is trash precisely because you can't mutate them. They end up being copied just to add elements or to change elements. I don't think this is what's being proposed here. Updates

Re: Kinds of containers

2015-10-21 Thread jmh530 via Digitalmars-d
On Wednesday, 21 October 2015 at 18:05:07 UTC, Jonathan M Davis wrote: However, I completely fail to understand why you'd ever want a container that was a value type. In my experience, it's very error-prone and adds no value. Are you saying there isn't a reason to use static arrays?

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 11:58 AM, Timon Gehr wrote: For which containers we want to support is "2." not a (wrapper around a) pointer to "3."? For those that need reference counting. -- Andrei

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 11:13 AM, Timon Gehr wrote: On 10/21/2015 05:08 PM, Timon Gehr wrote: There would be no mutable aliasing. Here, I mean within the data structure itself. There is nothing wrong with: class Cell{ int x=0; } FunSet!Cell a; a.insert(new Cell()); auto b=a; foreach(c;a) c.x=1;

Re: Kinds of containers

2015-10-21 Thread Brad Anderson via Digitalmars-d
On Wednesday, 21 October 2015 at 18:05:07 UTC, Jonathan M Davis wrote: On Wednesday, 21 October 2015 at 16:36:46 UTC, Brad Anderson wrote: On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei Alexandrescu wrote: [snip] 2. Reference containers. These have classic reference semantics (à la

Re: Kinds of containers

2015-10-21 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, 21 October 2015 at 18:14:39 UTC, jmh530 wrote: On Wednesday, 21 October 2015 at 18:05:07 UTC, Jonathan M Davis wrote: However, I completely fail to understand why you'd ever want a container that was a value type. In my experience, it's very error-prone and adds no value. Are

Re: Kinds of containers

2015-10-21 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, 21 October 2015 at 18:24:30 UTC, Robert burner Schadek wrote: On Wednesday, 21 October 2015 at 17:23:15 UTC, Andrei Alexandrescu wrote: Even simpler, hasMethod!(Container, "append") -- Andrei I know this goes against your talk at DConf, but having to write string parameters

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 12:12 PM, H. S. Teoh via Digitalmars-d wrote: On Wed, Oct 21, 2015 at 09:11:38AM -0400, Andrei Alexandrescu via Digitalmars-d wrote: [...] My finance folks also rave about Pandas. I wish I could fork myself to look into it. [...] Unfortunately, forking a human process takes 9

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 12:25 PM, Jonathan M Davis wrote: My experience with immutable containers is that their performance is trash precisely because you can't mutate them. That's actually the experience in the Scala community. Over and again people start with immutable containers all over the place

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 01:42 PM, Ulrich Kuettler wrote: On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei Alexandrescu wrote: I'm finally getting the cycles to get to thinking about Design by Introspection containers. First off, there are several general categories of containers. I think D should

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 11:08 AM, Timon Gehr wrote: Exactly. There would be no mutable aliasing. This way, the persistent data type can behave like a mutable value type, such as a COW or eager copy variant, but with nicer/different performance characteristics. It would be great if exchanging different

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 10:51 AM, Robert burner Schadek wrote: On Wednesday, 21 October 2015 at 14:20:23 UTC, Andrei Alexandrescu wrote: Containers will obey subsets of a nomenclature of primitives. Just to be crystal clear, something like this? void fun(Container)(ref Container c) if

Re: Kinds of containers

2015-10-21 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, 21 October 2015 at 16:36:46 UTC, Brad Anderson wrote: On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei Alexandrescu wrote: [snip] 2. Reference containers. These have classic reference semantics (à la Java). Internally, they may be implemented either as class objects or as

Re: Pandas [was Kinds of containers]

2015-10-21 Thread jmh530 via Digitalmars-d
On Wednesday, 21 October 2015 at 15:44:36 UTC, Russel Winder wrote: On Wed, 2015-10-21 at 09:11 -0400, Andrei Alexandrescu via Digitalmars-d wrote: […] My finance folks also rave about Pandas. I wish I could fork myself to look into it. Pandas is what makes Python a viable competitor to R.

Re: Kinds of containers

2015-10-21 Thread Zz via Digitalmars-d
On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei Alexandrescu wrote: I'm finally getting the cycles to get to thinking about Design by Introspection containers. First off, there are several general categories of containers. I think D should support all properly. One question is which we

Re: Kinds of containers

2015-10-21 Thread H. S. Teoh via Digitalmars-d
On Wed, Oct 21, 2015 at 06:38:08PM +, Jonathan M Davis via Digitalmars-d wrote: > On Wednesday, 21 October 2015 at 18:14:39 UTC, jmh530 wrote: [...] > >Are you saying there isn't a reason to use static arrays? > > A static array is of a fixed size, which almost no other containers > are. It

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 12:36 PM, Brad Anderson wrote: I don't understand why reference semantics would be implemented by the container themselves though. Why not a general purpose RC! (or RefCounted! if the current design is deemed sufficient) that can apply to anything, including containers? Two

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 12:34 PM, Ice Cream Man wrote: On Wednesday, 21 October 2015 at 16:25:19 UTC, Jonathan M Davis wrote: They're just too unwieldy and inefficient. - Jonathan M Davis Only if you don't know how to use them. They are very wieldy, efficient AND safe, if you do know how to swing the

Re: Kinds of containers

2015-10-21 Thread deadalnix via Digitalmars-d
On Thursday, 22 October 2015 at 02:13:12 UTC, bitwise wrote: I needed containers, so I implemented a few: https://github.com/bitwise-github/d-collections Currently included: List(T) - contiguous list like std::vector LinkedList(T) - doubly linked list like std::list Queue(T) - double-ended

Re: Kinds of containers

2015-10-21 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, 21 October 2015 at 18:48:18 UTC, Brad Anderson wrote: All that said, I agree with you that the implicit copying isn't really all that desirable. Perhaps there is a better way. What if instead of value semantics we had unique containers (akin to std.typecons.Unique or unique_ptr

Re: Kinds of containers

2015-10-21 Thread Ice Cream Man via Digitalmars-d
On Wednesday, 21 October 2015 at 18:50:05 UTC, Andrei Alexandrescu wrote: On 10/21/2015 12:34 PM, Ice Cream Man wrote: On Wednesday, 21 October 2015 at 16:25:19 UTC, Jonathan M Davis wrote: They're just too unwieldy and inefficient. - Jonathan M Davis Only if you don't know how to use them.

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 02:05 PM, Jonathan M Davis wrote: If we had value type containers and reference type containers, I would assume that they would at least share implementation, and maybe the reference types would just be wrappers around the value types. Well, I thought the same. I was surprised.

Re: Kinds of containers

2015-10-21 Thread Timon Gehr via Digitalmars-d
On 10/21/2015 07:25 PM, Andrei Alexandrescu wrote: It seems to me that's a departure from traditional persistent data structures. I don't think so. Those have immutable elements; Immutable insofar as the elements themselves don't change. It is easy to create a persistent list of

Re: Kinds of containers

2015-10-21 Thread MobPassenger via Digitalmars-d
On Wednesday, 21 October 2015 at 19:38:37 UTC, Jonathan M Davis wrote: On Wednesday, 21 October 2015 at 19:19:23 UTC, Andrei Alexandrescu wrote: I'd say let's first have a Pope before becoming more Catholic than him. -- Andrei I confess that I really don't understand that one. - Jonathan M

Re: Kinds of containers

2015-10-21 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, 21 October 2015 at 19:16:28 UTC, Andrei Alexandrescu wrote: Sometimes you want a value container as a member of a struct which in turn is a value type. Sure, but at least in theory, the struct's postblit should be able to copy a reference type container via dup or whatnot if

Re: Kinds of containers

2015-10-21 Thread Timon Gehr via Digitalmars-d
On 10/21/2015 01:05 PM, Andrei Alexandrescu wrote: I'll attempt to implement a few versions of each and see what they look like. The question here is what containers are of interest for D's standard library. There should probably also be wrappers that implement optimizations for small

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 03:38 PM, Jonathan M Davis wrote: On Wednesday, 21 October 2015 at 19:19:23 UTC, Andrei Alexandrescu wrote: I'd say let's first have a Pope before becoming more Catholic than him. -- Andrei I confess that I really don't understand that one. "More Catholic than the Pope" =

Re: Kinds of containers

2015-10-21 Thread jmh530 via Digitalmars-d
On Wednesday, 21 October 2015 at 18:38:10 UTC, Jonathan M Davis wrote: A static array is of a fixed size, which almost no other containers are. It also lives entirely on the stack, which almost no other containers do. If there's a container that lives entirely on the stack, then maybe it

Re: Kinds of containers

2015-10-21 Thread Timon Gehr via Digitalmars-d
On 10/21/2015 07:24 PM, Andrei Alexandrescu wrote: On 10/21/2015 11:08 AM, Timon Gehr wrote: Exactly. There would be no mutable aliasing. This way, the persistent data type can behave like a mutable value type, such as a COW or eager copy variant, but with nicer/different performance

Re: Kinds of containers

2015-10-21 Thread Ice Cream Man via Digitalmars-d
On Wednesday, 21 October 2015 at 19:07:50 UTC, Jonathan M Davis wrote: On Wednesday, 21 October 2015 at 18:48:18 UTC, Brad Anderson wrote: All that said, I agree with you that the implicit copying isn't really all that desirable. Perhaps there is a better way. What if instead of value

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 02:32 PM, Jonathan M Davis wrote: On Wednesday, 21 October 2015 at 18:24:30 UTC, Robert burner Schadek wrote: On Wednesday, 21 October 2015 at 17:23:15 UTC, Andrei Alexandrescu wrote: Even simpler, hasMethod!(Container, "append") -- Andrei I know this goes against your talk at

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 02:18 PM, Zz wrote: While looking at containers take a look at Jiri Soukup's work some good ideas could come from there.

Re: Kinds of containers

2015-10-21 Thread Andrei Alexandrescu via Digitalmars-d
On 10/21/2015 02:24 PM, Robert burner Schadek wrote: On Wednesday, 21 October 2015 at 17:23:15 UTC, Andrei Alexandrescu wrote: Even simpler, hasMethod!(Container, "append") -- Andrei I know this goes against your talk at DConf, but having to write string parameters does not feel good. I'm

Re: Kinds of containers

2015-10-21 Thread ponce via Digitalmars-d
On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei Alexandrescu wrote: The question here is what containers are of interest for D's standard library. I think the ones in the STL work well. So I'd like something along these lines. Something like std::vector would fit 90% of my needs (eg: a

Re: Kinds of containers

2015-10-21 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, 21 October 2015 at 19:18:44 UTC, Andrei Alexandrescu wrote: On 10/21/2015 02:24 PM, Robert burner Schadek wrote: On Wednesday, 21 October 2015 at 17:23:15 UTC, Andrei Alexandrescu wrote: Even simpler, hasMethod!(Container, "append") -- Andrei I know this goes against your talk

Re: Kinds of containers

2015-10-21 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, 21 October 2015 at 19:19:23 UTC, Andrei Alexandrescu wrote: I'd say let's first have a Pope before becoming more Catholic than him. -- Andrei I confess that I really don't understand that one. - Jonathan M Davis

  1   2   >