Re: [Proposal] Weak reference implementation for D

2013-10-17 Thread Martin Nowak
On 10/16/2013 12:45 AM, Walter Bright wrote: http://d.puremagic.com/issues/show_bug.cgi?id=4151 does not contain the info in your post starting this thread, nor does it contain any link to this thread. Yeah, more cross references please. I personally dislike the DIP proliferation for anything

Re: [Proposal] Weak reference implementation for D

2013-10-17 Thread Martin Nowak
On 10/13/2013 09:47 AM, Denis Shelomovskij wrote: * Alex's one from MCI: https://github.com/lycus/mci/blob/f9165c287f92e4ef70674828fbadb33ee3967547/src/mci/core/weak.d I remember talking about this with Alex. He wanted to add some functions to the GC and this is what I came up with

Re: [Proposal] Weak reference implementation for D

2013-10-17 Thread Denis Shelomovskij
17.10.2013 12:09, Martin Nowak пишет: On 10/13/2013 09:47 AM, Denis Shelomovskij wrote: * Alex's one from MCI: https://github.com/lycus/mci/blob/f9165c287f92e4ef70674828fbadb33ee3967547/src/mci/core/weak.d I remember talking about this with Alex. He wanted to add some functions to

Re: [Proposal] Weak reference implementation for D

2013-10-17 Thread Sean Kelly
On Thursday, 17 October 2013 at 08:09:24 UTC, Martin Nowak wrote: On 10/13/2013 09:47 AM, Denis Shelomovskij wrote: * Alex's one from MCI: https://github.com/lycus/mci/blob/f9165c287f92e4ef70674828fbadb33ee3967547/src/mci/core/weak.d I remember talking about this with Alex. He wanted

Re: [Proposal] Weak reference implementation for D

2013-10-16 Thread Denis Shelomovskij
16.10.2013 3:20, Sean Kelly пишет: On Tuesday, 15 October 2013 at 22:09:17 UTC, Robert wrote: The problem is that destructors and thus the registered hooks for the dispose events are called when threads are already resumed. If this wasn't the case there would actually be no problems. Gotcha.

Re: [Proposal] Weak reference implementation for D

2013-10-16 Thread Denis Shelomovskij
16.10.2013 3:20, Sean Kelly пишет: On Tuesday, 15 October 2013 at 22:09:17 UTC, Robert wrote: The problem is that destructors and thus the registered hooks for the dispose events are called when threads are already resumed. If this wasn't the case there would actually be no problems. Gotcha.

Re: [Proposal] Weak reference implementation for D

2013-10-16 Thread Sean Kelly
On Wednesday, 16 October 2013 at 10:02:28 UTC, Denis Shelomovskij wrote: 16.10.2013 3:20, Sean Kelly пишет: Looking at the code... I think you'll get this to work, but manipulating such user-mode weak references seems really expensive. Why not work on a DIP to get them built in? For example,

Re: [Proposal] Weak reference implementation for D

2013-10-15 Thread Denis Shelomovskij
14.10.2013 17:42, robert пишет: Damn it, you are right I did not think this through, somehow thought the use in addrOf is enough, which is of course crap. Thank's a lot for your time, I'll fix this ASAP. So, here are your revised version:

Re: [Proposal] Weak reference implementation for D

2013-10-15 Thread Sean Kelly
Perhaps I missed it from skimming, but why are we using atomic operations here anyway? Has testing revealed that it's necessary?

Re: [Proposal] Weak reference implementation for D

2013-10-15 Thread John Colvin
On Tuesday, 15 October 2013 at 18:57:16 UTC, Sean Kelly wrote: Perhaps I missed it from skimming, but why are we using atomic operations here anyway? Has testing revealed that it's necessary? I presume you don't mean running some code and then seeing if it breaks as a test to see if atomic

Re: [Proposal] Weak reference implementation for D

2013-10-15 Thread Sean Kelly
On Tuesday, 15 October 2013 at 19:51:00 UTC, John Colvin wrote: On Tuesday, 15 October 2013 at 18:57:16 UTC, Sean Kelly wrote: Perhaps I missed it from skimming, but why are we using atomic operations here anyway? Has testing revealed that it's necessary? I presume you don't mean running

Re: [Proposal] Weak reference implementation for D

2013-10-15 Thread Dejan Lekic
On Tue, 15 Oct 2013 20:57:14 +0200, Sean Kelly wrote: Perhaps I missed it from skimming, but why are we using atomic operations here anyway? Has testing revealed that it's necessary? I believe it is the why make it easy when we can make it complicated? approach...

Re: [Proposal] Weak reference implementation for D

2013-10-15 Thread Robert
So, here are your revised version: https://github.com/phobos-x/phobosx/blob/1f0016c84c2043da0b9d2dafe65f54fcf6b6b8fa/source/phobosx/signal.d Sorry, but you are making the same mistake again. Yeah, I made a mistake again. In my mind it was ok because o is read from a shared variable, but this

Re: [Proposal] Weak reference implementation for D

2013-10-15 Thread Robert
Well sure, but why not use a Mutex? What does trying to sort out a correct lock-free algorithm gain us here? It is not about concurrency for general purpose (phobosx.signal is no more thread safe than std.signals), but for the GC. A reference is hidden from the GC, when making it visible

Re: [Proposal] Weak reference implementation for D

2013-10-15 Thread Robert
See also: http://d.puremagic.com/issues/show_bug.cgi?id=4150 Best regards, Robert

Re: [Proposal] Weak reference implementation for D

2013-10-15 Thread Walter Bright
On 10/13/2013 11:24 PM, Denis Shelomovskij wrote: 13.10.2013 22:19, Walter Bright пишет: On 10/13/2013 12:47 AM, Denis Shelomovskij wrote: --- Proposal --- Please post as a DIP: http://wiki.dlang.org/DIPs The trouble with it as a n.g. posting is they tend to scroll off and be forgotten.

Re: [Proposal] Weak reference implementation for D

2013-10-15 Thread Sean Kelly
On Tuesday, 15 October 2013 at 22:09:17 UTC, Robert wrote: The problem is that destructors and thus the registered hooks for the dispose events are called when threads are already resumed. If this wasn't the case there would actually be no problems. Gotcha. Looking at the code... I think

Re: [Proposal] Weak reference implementation for D

2013-10-15 Thread inout
On Tuesday, 15 October 2013 at 23:20:39 UTC, Sean Kelly wrote: On Tuesday, 15 October 2013 at 22:09:17 UTC, Robert wrote: The problem is that destructors and thus the registered hooks for the dispose events are called when threads are already resumed. If this wasn't the case there would

Re: [Proposal] Weak reference implementation for D

2013-10-14 Thread Denis Shelomovskij
13.10.2013 22:19, Walter Bright пишет: On 10/13/2013 12:47 AM, Denis Shelomovskij wrote: --- Proposal --- Please post as a DIP: http://wiki.dlang.org/DIPs The trouble with it as a n.g. posting is they tend to scroll off and be forgotten. Why? There is already enhancement request 4151 to

Re: [Proposal] Weak reference implementation for D

2013-10-14 Thread Denis Shelomovskij
13.10.2013 21:36, Robert пишет: * Robert's one from his new `std.signals` implementation proposal: https://github.com/phobos-x/phobosx/blob/d0cc6b45511465ef1d493b0d7226ccb990ae84e8/source/phobosx/signal.d Obviously I don't see it, otherwise I would have fixed it. Maybe you could

Re: [Proposal] Weak reference implementation for D

2013-10-14 Thread robert
1. Have you read `gc.gc.fullcollect`, I mean a general function structure, not every line? If not, read it or you have no idea how collection performs. I haven't, I relied on: http://dlang.org/garbage.html , but I will now - thanks. If the information at garbage.html isn't completely wrong I

Re: [Proposal] Weak reference implementation for D

2013-10-14 Thread Denis Shelomovskij
14.10.2013 13:04, robert пишет: Why would I be angry with a stranger who insults me in public? I don't understand your concerns. No insults assumed! Just ugly truth about all of us. ) If you are more experienced in this area I am glad if you share your insights and Walter and Andrei often

Re: [Proposal] Weak reference implementation for D

2013-10-14 Thread robert
Easy, man. I have never met morons here, except, probably, myself. My apologies if I got you wrong! So you code is incorrect and lets show it. When you give your code for eating to the compiler, it can does whatever it want but guarantee your program will work as you have written it

[Proposal] Weak reference implementation for D

2013-10-13 Thread Denis Shelomovskij
--- Proposal --- The proposal is to add weak reference functionality based on `unstd.memory.weakref`. It can be placed e.g. in `core.memory`. Source code: https://bitbucket.org/denis-sh/unstandard/src/HEAD/unstd/memory/weakref.d Documentation:

Re: [Proposal] Weak reference implementation for D

2013-10-13 Thread Benjamin Thaut
Am 13.10.2013 09:47, schrieb Denis Shelomovskij: --- Proposal --- The proposal is to add weak reference functionality based on `unstd.memory.weakref`. It can be placed e.g. in `core.memory`. Source code: https://bitbucket.org/denis-sh/unstandard/src/HEAD/unstd/memory/weakref.d Documentation:

Re: [Proposal] Weak reference implementation for D

2013-10-13 Thread Temtaime
Denis, you forgot to say that it's need to download yours unstd library source too. Also there's only visualdproj to build it.

Re: [Proposal] Weak reference implementation for D

2013-10-13 Thread Sönke Ludwig
Am 13.10.2013 09:47, schrieb Denis Shelomovskij: --- Proposal --- The proposal is to add weak reference functionality based on `unstd.memory.weakref`. It can be placed e.g. in `core.memory`. Source code: https://bitbucket.org/denis-sh/unstandard/src/HEAD/unstd/memory/weakref.d Documentation:

Re: [Proposal] Weak reference implementation for D

2013-10-13 Thread Denis Shelomovskij
13.10.2013 12:55, Sönke Ludwig пишет: Am 13.10.2013 09:47, schrieb Denis Shelomovskij: Just to reassure, the following race-condition doesn't exist, right? It looks like GC.addRoot() makes guarantees by taking the GC lock or something similar? time - thread1: GC collection |

Re: [Proposal] Weak reference implementation for D

2013-10-13 Thread Denis Shelomovskij
13.10.2013 12:36, Benjamin Thaut пишет: Will rt_attachDisposeEvent also work with std.allocator? Or does it rely on the GC running? What exactly do you mean? `rt_attachDisposeEvent` adds delegate to `object.__monitor.devt` array which is called from `rt_finalize2 - _d_monitordelete -

Re: [Proposal] Weak reference implementation for D

2013-10-13 Thread Robert
* Robert's one from his new `std.signals` implementation proposal: https://github.com/phobos-x/phobosx/blob/d0cc6b45511465ef1d493b0d7226ccb990ae84e8/source/phobosx/signal.d Obviously I don't see it, otherwise I would have fixed it. Maybe you could elaborate a bit on your claim?

Re: [Proposal] Weak reference implementation for D

2013-10-13 Thread Michael
And line 61: what exactly mean a two !! in alive property? +1 weakref

Re: [Proposal] Weak reference implementation for D

2013-10-13 Thread Andrei Alexandrescu
On 10/13/13 11:07 AM, Michael wrote: And line 61: what exactly mean a two !! in alive property? Convert this to bool. Andrei

Re: [Proposal] Weak reference implementation for D

2013-10-13 Thread Walter Bright
On 10/13/2013 12:47 AM, Denis Shelomovskij wrote: --- Proposal --- Please post as a DIP: http://wiki.dlang.org/DIPs The trouble with it as a n.g. posting is they tend to scroll off and be forgotten.

Re: [Proposal] Weak reference implementation for D

2013-10-13 Thread Flamaros
On Sunday, 13 October 2013 at 07:47:55 UTC, Denis Shelomovskij wrote: --- Proposal --- The proposal is to add weak reference functionality based on `unstd.memory.weakref`. It can be placed e.g. in `core.memory`. Source code:

Re: [Proposal] Weak reference implementation for D

2013-10-13 Thread Michael
On Sunday, 13 October 2013 at 18:11:38 UTC, Andrei Alexandrescu wrote: On 10/13/13 11:07 AM, Michael wrote: And line 61: what exactly mean a two !! in alive property? Convert this to bool. Andrei Thanks)

Re: [Proposal] Weak reference implementation for D

2013-10-13 Thread ilya-stromberg
On Sunday, 13 October 2013 at 07:47:55 UTC, Denis Shelomovskij wrote: --- Proposal --- The proposal is to add weak reference functionality based on `unstd.memory.weakref`. It can be placed e.g. in `core.memory`. +1