digitalmars.D - Next step on reference counting topics
- Andrei Alexandrescu (15/15) May 12 2014 There's been a lot of talk lately regarding improving resource
- Jacob Carlborg (5/17) May 12 2014 Perhaps, as has been already stared, sprinkle Phobos with output ranges
- Dicebot (14/19) May 13 2014 We don't have language tools to do it. Main problem with
- Andrei Alexandrescu (3/22) May 13 2014 "alias this" should be of help here. Could you please try it? Thanks! --...
- Timon Gehr (10/37) May 13 2014 class A{
- Dicebot (4/39) May 13 2014 We don't have multiple alias this to cover all parent classes.
- Dicebot (3/3) May 13 2014 On actual topic of next step - I agree with Jacob, removing all
- Andrei Alexandrescu (4/7) May 13 2014 That's a given. This task and improving RC don't compete (except, of
- Dicebot (6/14) May 15 2014 You should start with at least some sort of design document for
- Andrei Alexandrescu (7/20) May 15 2014 The design is part of the championing. But haven't heard a peep - it
- Dicebot (5/34) May 15 2014 Well I have already pointed out my concerns in this thread. Until
- Walter Bright (2/5) May 13 2014 I'm working on it. Could use some help!
- Ethan (28/28) May 15 2014 I've been trying to think of a solution to use over here at
- Dicebot (3/19) May 13 2014 Also please std.typecons.refcounted, let's stop that flat
There's been a lot of talk lately regarding improving resource management for D, and I'd like to figure the next logical step to take. It seems clear that we have reached a collective impasse on a few fundamentals, and that more just talk about it all is at the point of diminishing returns. One action item that is hopefully useful to people of all viewpoints is to double down on library support, and see how far we can get and what insights we collect from the experience. For that I'm proposing we start real work toward a state-of-the-art std.refcounted module. It would include adapters for class, array, and pointer types, and should inform language improvements for qualifiers (i.e. the tail-const problem), copy elision, literals, operators, and such. Who wants to champion this effort? Thanks, Andrei
May 12 2014
On 12/05/14 21:00, Andrei Alexandrescu wrote:There's been a lot of talk lately regarding improving resource management for D, and I'd like to figure the next logical step to take. It seems clear that we have reached a collective impasse on a few fundamentals, and that more just talk about it all is at the point of diminishing returns. One action item that is hopefully useful to people of all viewpoints is to double down on library support, and see how far we can get and what insights we collect from the experience. For that I'm proposing we start real work toward a state-of-the-art std.refcounted module. It would include adapters for class, array, and pointer types, and should inform language improvements for qualifiers (i.e. the tail-const problem), copy elision, literals, operators, and such.Perhaps, as has been already stared, sprinkle Phobos with output ranges and/or allocators. -- /Jacob Carlborg
May 12 2014
On Monday, 12 May 2014 at 19:00:33 UTC, Andrei Alexandrescu wrote:For that I'm proposing we start real work toward a state-of-the-art std.refcounted module. It would include adapters for class, array, and pointer types, and should inform language improvements for qualifiers (i.e. the tail-const problem), copy elision, literals, operators, and such.We don't have language tools to do it. Main problem with implementing reference counted pointers as structs is that you are forced to abandon polymorphism: class A {} class B : A {} void foo(RefCounted!A) {} void main() { RefCounted!B b = new B(); foo(b); // no way to make it work } This severely limits applicability of such library solution, especially when it comes to something like exceptions.
May 13 2014
On 5/13/14, 6:41 AM, Dicebot wrote:On Monday, 12 May 2014 at 19:00:33 UTC, Andrei Alexandrescu wrote:"alias this" should be of help here. Could you please try it? Thanks! -- AndreiFor that I'm proposing we start real work toward a state-of-the-art std.refcounted module. It would include adapters for class, array, and pointer types, and should inform language improvements for qualifiers (i.e. the tail-const problem), copy elision, literals, operators, and such.We don't have language tools to do it. Main problem with implementing reference counted pointers as structs is that you are forced to abandon polymorphism: class A {} class B : A {} void foo(RefCounted!A) {} void main() { RefCounted!B b = new B(); foo(b); // no way to make it work } This severely limits applicability of such library solution, especially when it comes to something like exceptions.
May 13 2014
On 05/13/2014 05:11 PM, Andrei Alexandrescu wrote:On 5/13/14, 6:41 AM, Dicebot wrote:class A{ RefCounted!A r(){ ... } } class B : A { override RefCounted!B r(){ ... } // ... } RefCounted!B[] b; RefCounted!(const(A))[] a=b; // ... etc.On Monday, 12 May 2014 at 19:00:33 UTC, Andrei Alexandrescu wrote:"alias this" should be of help here. Could you please try it? Thanks! -- AndreiFor that I'm proposing we start real work toward a state-of-the-art std.refcounted module. It would include adapters for class, array, and pointer types, and should inform language improvements for qualifiers (i.e. the tail-const problem), copy elision, literals, operators, and such.We don't have language tools to do it. Main problem with implementing reference counted pointers as structs is that you are forced to abandon polymorphism: class A {} class B : A {} void foo(RefCounted!A) {} void main() { RefCounted!B b = new B(); foo(b); // no way to make it work } This severely limits applicability of such library solution, especially when it comes to something like exceptions.
May 13 2014
On Tuesday, 13 May 2014 at 15:11:48 UTC, Andrei Alexandrescu wrote:On 5/13/14, 6:41 AM, Dicebot wrote:We don't have multiple alias this to cover all parent classes. Also you can't throw struct as an Exception. Also Timon's example.On Monday, 12 May 2014 at 19:00:33 UTC, Andrei Alexandrescu wrote:"alias this" should be of help here. Could you please try it? Thanks! -- AndreiFor that I'm proposing we start real work toward a state-of-the-art std.refcounted module. It would include adapters for class, array, and pointer types, and should inform language improvements for qualifiers (i.e. the tail-const problem), copy elision, literals, operators, and such.We don't have language tools to do it. Main problem with implementing reference counted pointers as structs is that you are forced to abandon polymorphism: class A {} class B : A {} void foo(RefCounted!A) {} void main() { RefCounted!B b = new B(); foo(b); // no way to make it work } This severely limits applicability of such library solution, especially when it comes to something like exceptions.
May 13 2014
On actual topic of next step - I agree with Jacob, removing all internal allocations from Phobos is most beneficial short-term goal.
May 13 2014
On 5/13/14, 6:43 AM, Dicebot wrote:On actual topic of next step - I agree with Jacob, removing all internal allocations from Phobos is most beneficial short-term goal.That's a given. This task and improving RC don't compete (except, of course, for bearing on the same people). I ask again, who wants to champion std.refcounted? Rainer? Manu? Michel? Are you there? -- Andrei
May 13 2014
On Tuesday, 13 May 2014 at 15:14:16 UTC, Andrei Alexandrescu wrote:On 5/13/14, 6:43 AM, Dicebot wrote:You should start with at least some sort of design document for what such module should look like. Right now it is not clear to me at all what kind of improvements are desired within current language limits.On actual topic of next step - I agree with Jacob, removing all internal allocations from Phobos is most beneficial short-term goal.That's a given. This task and improving RC don't compete (except, of course, for bearing on the same people). I ask again, who wants to champion std.refcounted? Rainer? Manu? Michel? Are you there? -- Andrei
May 15 2014
On 5/15/14, 6:02 AM, Dicebot wrote:On Tuesday, 13 May 2014 at 15:14:16 UTC, Andrei Alexandrescu wrote:The design is part of the championing. But haven't heard a peep - it seems everybody wants to go to heaven, but nobody wants to die :o).On 5/13/14, 6:43 AM, Dicebot wrote:You should start with at least some sort of design document for what such module should look like.On actual topic of next step - I agree with Jacob, removing all internal allocations from Phobos is most beneficial short-term goal.That's a given. This task and improving RC don't compete (except, of course, for bearing on the same people). I ask again, who wants to champion std.refcounted? Rainer? Manu? Michel? Are you there? -- AndreiRight now it is not clear to me at all what kind of improvements are desired within current language limits.The clarify it to yourself and others. Start with a library approach to making reference counting easy and convenient. Then see how it informs possible language improvements. Andrei
May 15 2014
On Thursday, 15 May 2014 at 15:46:13 UTC, Andrei Alexandrescu wrote:On 5/15/14, 6:02 AM, Dicebot wrote:Well I have already pointed out my concerns in this thread. Until some solution is found new refcount module doesn't seem worth putting the effort into.On Tuesday, 13 May 2014 at 15:14:16 UTC, Andrei Alexandrescu wrote:The design is part of the championing. But haven't heard a peep - it seems everybody wants to go to heaven, but nobody wants to die :o).On 5/13/14, 6:43 AM, Dicebot wrote:You should start with at least some sort of design document for what such module should look like.On actual topic of next step - I agree with Jacob, removing all internal allocations from Phobos is most beneficial short-term goal.That's a given. This task and improving RC don't compete (except, of course, for bearing on the same people). I ask again, who wants to champion std.refcounted? Rainer? Manu? Michel? Are you there? -- AndreiRight now it is not clear to me at all what kind of improvements are desired within current language limits.The clarify it to yourself and others. Start with a library approach to making reference counting easy and convenient. Then see how it informs possible language improvements.
May 15 2014
On 5/13/2014 6:43 AM, Dicebot wrote:On actual topic of next step - I agree with Jacob, removing all internal allocations from Phobos is most beneficial short-term goal.I'm working on it. Could use some help!
May 13 2014
I've been trying to think of a solution to use over here at Remedy for making the garbage collector reference count allocations instead of the current scan method (even with Rainer Schütze's GC it still does a scan, and I'd feel much more comfortable not having to schedule a GC collection somewhere in our update loop). I've totally missed the other threads on reference counting, but should reference counting be a part of some library that you can optionally use or should the garbage collector hide all that from you? My thinking on the subject is that you only need one additional function added to the garbage collector that handles pointer assignments. The parameters are a ref to the pointer you're assigning to, and the new pointer. The GC would then decrement the reference count for the memory referenced by the pointer you're assigning to, and increment the reference count fr the new memory referenced. This, I imagine, would fit neatly in with slices and classes equally. It would also be optional - the current default GC wouldn't do anything with the function and . The downside is that a pointer assign would invoke a GC call and that it would still need to deal with circular dependencies in some fashion (however dealing with that at an allocation level rather than a class level seems potentially less problematic to me). If this is beyond the scope of this thread, I'll start up a new one to discuss all the potential pitfalls and problems that could be encountered. I haven't had any time to actually do research in to it or trial it yet.
May 15 2014
On Monday, 12 May 2014 at 19:00:33 UTC, Andrei Alexandrescu wrote:There's been a lot of talk lately regarding improving resource management for D, and I'd like to figure the next logical step to take. It seems clear that we have reached a collective impasse on a few fundamentals, and that more just talk about it all is at the point of diminishing returns. One action item that is hopefully useful to people of all viewpoints is to double down on library support, and see how far we can get and what insights we collect from the experience. For that I'm proposing we start real work toward a state-of-the-art std.refcounted module. It would include adapters for class, array, and pointer types, and should inform language improvements for qualifiers (i.e. the tail-const problem), copy elision, literals, operators, and such. Who wants to champion this effort? Thanks, AndreiAlso please std.typecons.refcounted, let's stop that flat hierarchy madness.
May 13 2014