Re: Shared - Another Thread

2018-10-20 Thread Manu via Digitalmars-d
On Sat., 20 Oct. 2018, 7:00 am Stanislav Blinov via Digitalmars-d, < digitalmars-d@puremagic.com> wrote: > On Saturday, 20 October 2018 at 02:09:56 UTC, Dominikus Dittes > Scherkl wrote: > > On Saturday, 20 October 2018 at 00:46:36 UTC, Nicholas Wilson > > wrote: > >> Mutable = value may change >

Re: Shared - Another Thread

2018-10-20 Thread Stanislav Blinov via Digitalmars-d
On Saturday, 20 October 2018 at 02:09:56 UTC, Dominikus Dittes Scherkl wrote: On Saturday, 20 October 2018 at 00:46:36 UTC, Nicholas Wilson wrote: Mutable = value may change const = I will not change the value immutable = the value will not change unshared = I (well the current thread) owns

Re: Shared - Another Thread

2018-10-20 Thread Manu via Digitalmars-d
On Sat., 20 Oct. 2018, 12:10 am Dominikus Dittes Scherkl via Digitalmars-d, wrote: > On Saturday, 20 October 2018 at 06:04:45 UTC, Manu wrote: > > How can you find that such a construct carries its weight with > > respect > > to its rare-ness, when its usefulness is very limited to begin > >

Re: Shared - Another Thread

2018-10-20 Thread Manu via Digitalmars-d
On Sat., 20 Oct. 2018, 12:10 am Dominikus Dittes Scherkl via Digitalmars-d, wrote: > On Saturday, 20 October 2018 at 06:04:45 UTC, Manu wrote: > > How can you find that such a construct carries its weight with > > respect > > to its rare-ness, when its usefulness is very limited to begin > >

Re: Shared - Another Thread

2018-10-20 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Saturday, 20 October 2018 at 06:04:45 UTC, Manu wrote: How can you find that such a construct carries its weight with respect to its rare-ness, when its usefulness is very limited to begin with? I suggested it only because of the resistance to the proposed implicit cast to shared. But I

Re: Shared - Another Thread

2018-10-20 Thread Manu via Digitalmars-d
On Fri, Oct 19, 2018 at 5:05 PM Dominikus Dittes Scherkl via Digitalmars-d wrote: > > Therefore it is possible to implicitly cast from mutable or > immutable to const but not in any other direction. > > I think for unshared, shared and threadsave it should be the same: > The second is a

Re: Shared - Another Thread

2018-10-19 Thread Manu via Digitalmars-d
On Fri, Oct 19, 2018 at 4:45 PM Dominikus Dittes Scherkl via Digitalmars-d wrote: > > On Friday, 19 October 2018 at 18:11:50 UTC, Manu wrote: > > On Fri, Oct 19, 2018 at 6:45 AM Dominikus Dittes Scherkl via > > Digitalmars-d wrote: > >> > >> On Thursday, 18 October 2018 at 16:24:39 UTC, Manu

Re: Shared - Another Thread

2018-10-19 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Saturday, 20 October 2018 at 00:46:36 UTC, Nicholas Wilson wrote: Mutable = value may change const = I will not change the value immutable = the value will not change unshared = I (well the current thread) owns the reference shared = reference not owned, no unordered access, no (unordered)

Re: Shared - Another Thread

2018-10-19 Thread Nicholas Wilson via Digitalmars-d
On Saturday, 20 October 2018 at 00:00:49 UTC, Dominikus Dittes Scherkl wrote: Hmm. mutable, immutable and const form a triple, the second is a declaration attribute, the last an parameter attribute, indicating that you don't want to modify the parameter, may it be because you can't (as it is

Re: Shared - Another Thread

2018-10-19 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Friday, 19 October 2018 at 15:46:20 UTC, Stanislav Blinov wrote: On Friday, 19 October 2018 at 13:40:54 UTC, Dominikus Dittes Scherkl wrote: Conflating "shared" and "threadsave" in that manner was, I think, the biggest mistake of your proposal. He talked about it in a previous thread, and

Re: Shared - Another Thread

2018-10-19 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Friday, 19 October 2018 at 18:11:50 UTC, Manu wrote: On Fri, Oct 19, 2018 at 6:45 AM Dominikus Dittes Scherkl via Digitalmars-d wrote: On Thursday, 18 October 2018 at 16:24:39 UTC, Manu wrote: > [...] What issues am I failing to address? [...] Another point is the part of "how can the

Re: Shared - Another Thread

2018-10-19 Thread Manu via Digitalmars-d
On Fri, Oct 19, 2018 at 6:45 AM Dominikus Dittes Scherkl via Digitalmars-d wrote: > > On Thursday, 18 October 2018 at 16:24:39 UTC, Manu wrote: > > On Wednesday, 17 October 2018 at 22:56:26 UTC, H. S. Teoh wrote: > >> What cracks me up with Manu's proposal is that it is its > >> simplicity and

Re: Shared - Another Thread

2018-10-19 Thread Stanislav Blinov via Digitalmars-d
On Friday, 19 October 2018 at 13:40:54 UTC, Dominikus Dittes Scherkl wrote: On Thursday, 18 October 2018 at 16:24:39 UTC, Manu wrote: On Wednesday, 17 October 2018 at 22:56:26 UTC, H. S. Teoh wrote: What cracks me up with Manu's proposal is that it is its simplicity and lack of ambition that

Re: Shared - Another Thread

2018-10-19 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Thursday, 18 October 2018 at 16:24:39 UTC, Manu wrote: On Wednesday, 17 October 2018 at 22:56:26 UTC, H. S. Teoh wrote: What cracks me up with Manu's proposal is that it is its simplicity and lack of ambition that is criticized the most. shared is a clusterfuck, according to what I gathered

Re: Shared - Another Thread

2018-10-18 Thread Paolo Invernizzi via Digitalmars-d
On Thursday, 18 October 2018 at 21:14:54 UTC, Stanislav Blinov wrote: On Thursday, 18 October 2018 at 20:59:59 UTC, Erik van Velzen wrote: [...] Quite a simple reason: it was years ago, however old you are now you were younger and less experienced, and probably didn't understand something

Re: Shared - Another Thread

2018-10-18 Thread Stanislav Blinov via Digitalmars-d
On Thursday, 18 October 2018 at 20:59:59 UTC, Erik van Velzen wrote: Let me start by saying I'm willing to admit that I was factually wrong. Also keep in mind that "me having an impression" is something that is can't be independently verified and you'll have to take my at my word. Just

Re: Shared - Another Thread

2018-10-18 Thread Erik van Velzen via Digitalmars-d
Let me start by saying I'm willing to admit that I was factually wrong. Also keep in mind that "me having an impression" is something that is can't be independently verified and you'll have to take my at my word. Just that the exact reason for that impression was lost to the sands of

Re: Shared - Another Thread

2018-10-18 Thread Erik van Velzen via Digitalmars-d
On Thursday, 18 October 2018 at 19:09:42 UTC, Patrick Schluter wrote: On Thursday, 18 October 2018 at 16:24:39 UTC, Manu wrote: Elaborate on this... It's clearly over-ambitious if anything. What issues am I failing to address? I'm creating a situation where using shared has a meaning, is

Re: Shared - Another Thread

2018-10-18 Thread Stanislav Blinov via Digitalmars-d
On Thursday, 18 October 2018 at 20:10:18 UTC, Erik van Velzen wrote: When shared stood up in its current form, expectation was made "this will be threadsafe automatically - we'll figure out how in the future". It never was like that. At all. I don't think either Walter or Andrei are

Re: Shared - Another Thread

2018-10-18 Thread H. S. Teoh via Digitalmars-d
On Thu, Oct 18, 2018 at 07:09:42PM +, Patrick Schluter via Digitalmars-d wrote: [...] > I often have the impression that a lot of things are going slower than > necessary because a mentality where the perfect is in the way of good. That is indeed an all-too-frequent malady around these

Re: Shared - Another Thread

2018-10-18 Thread Patrick Schluter via Digitalmars-d
On Thursday, 18 October 2018 at 17:01:46 UTC, Stanislav Blinov wrote: On Thursday, 18 October 2018 at 16:31:33 UTC, Vijay Nayar wrote: Imagine a simple algorithm that does logic on very long numbers, split into bytes. One multi-threaded implementation may use 4 threads. The first operating

Re: Shared - Another Thread

2018-10-18 Thread Patrick Schluter via Digitalmars-d
On Thursday, 18 October 2018 at 16:24:39 UTC, Manu wrote: On Thu., 18 Oct. 2018, 5:05 am Patrick Schluter via Digitalmars-d, < digitalmars-d@puremagic.com> wrote: On Wednesday, 17 October 2018 at 22:56:26 UTC, H. S. Teoh wrote: >> If something might be used by someone else it's better not >>

Re: Shared - Another Thread

2018-10-18 Thread Stanislav Blinov via Digitalmars-d
Pardon the snarkiness, I probably need to get some air from that other shared thread.

Re: Shared - Another Thread

2018-10-18 Thread Stanislav Blinov via Digitalmars-d
On Thursday, 18 October 2018 at 16:31:33 UTC, Vijay Nayar wrote: Imagine a simple algorithm that does logic on very long numbers, split into bytes. One multi-threaded implementation may use 4 threads. The first operating on bytes 0, 4, 8, etc. The second operating on bytes 1, 5, 9, etc.

Re: Shared - Another Thread

2018-10-18 Thread Vijay Nayar via Digitalmars-d
On Wednesday, 17 October 2018 at 21:12:49 UTC, Stefan Koch wrote: Hi, reading the other shared thread "shared - i need to be useful"(https://forum.dlang.org/thread/mailman.4299.1539629222.29801.digitalmar...@puremagic.com) let me to an important realisation concerning the reason shareding

Re: Shared - Another Thread

2018-10-18 Thread Manu via Digitalmars-d
On Thu., 18 Oct. 2018, 5:05 am Patrick Schluter via Digitalmars-d, < digitalmars-d@puremagic.com> wrote: > On Wednesday, 17 October 2018 at 22:56:26 UTC, H. S. Teoh wrote: > >> If something might be used by someone else it's better not to > >> touch it, unless one has confirmation it is not used

Re: Shared - Another Thread

2018-10-18 Thread Patrick Schluter via Digitalmars-d
On Wednesday, 17 October 2018 at 22:56:26 UTC, H. S. Teoh wrote: If something might be used by someone else it's better not to touch it, unless one has confirmation it is not used by someone else. This is what shared has to enforce. Yes. But how can the compiler statically verify this?

Re: Shared - Another Thread

2018-10-18 Thread Paolo Invernizzi via Digitalmars-d
On Wednesday, 17 October 2018 at 21:55:48 UTC, H. S. Teoh wrote: The problem, of course, is that they are also charged particles, and the electromagnetic forces that hold the atom in place would be greatly disturbed if two atoms were to occupy the same space simultaneously, leading to a (very

Re: Shared - Another Thread

2018-10-17 Thread Stefan Koch via Digitalmars-d
On Wednesday, 17 October 2018 at 22:56:26 UTC, H. S. Teoh wrote: On Wed, Oct 17, 2018 at 10:13:37PM +, Stefan Koch via Digitalmars-d wrote: On Wednesday, 17 October 2018 at 21:55:48 UTC, H. S. Teoh wrote: [...] > But nobody will be building a fusion engine out of race > conditions anytime

Re: Shared - Another Thread

2018-10-17 Thread H. S. Teoh via Digitalmars-d
On Wed, Oct 17, 2018 at 10:13:37PM +, Stefan Koch via Digitalmars-d wrote: > On Wednesday, 17 October 2018 at 21:55:48 UTC, H. S. Teoh wrote: [...] > > But nobody will be building a fusion engine out of race conditions > > anytime in the foreseeable future. :-D [...] > Now my analogy sounds

Re: Shared - Another Thread

2018-10-17 Thread Stefan Koch via Digitalmars-d
On Wednesday, 17 October 2018 at 21:55:48 UTC, H. S. Teoh wrote: Nah, that's not even anywhere close to nuclear fusion. The atoms which make up your body (and basically everything else) are mostly empty, with just a tiny speck of a nucleus, and a bunch of extremely tiny electrons zipping

Re: Shared - Another Thread

2018-10-17 Thread Stanislav Blinov via Digitalmars-d
On Wednesday, 17 October 2018 at 21:55:48 UTC, H. S. Teoh wrote: But nobody will be building a fusion engine out of race conditions anytime in the foreseeable future. :-D We should be so blessed...

Re: Shared - Another Thread

2018-10-17 Thread H. S. Teoh via Digitalmars-d
On Wed, Oct 17, 2018 at 09:29:07PM +, Stefan Koch via Digitalmars-d wrote: > On Wednesday, 17 October 2018 at 21:12:49 UTC, Stefan Koch wrote: > > [another person] cannot actually occupy the same space. It is > > physically impossible. > > Actually, that's not quite true, If they were to try

Re: Shared - Another Thread

2018-10-17 Thread Stefan Koch via Digitalmars-d
On Wednesday, 17 October 2018 at 21:40:35 UTC, Stanislav Blinov wrote: Now, I perfectly understand what Manu wants: for `shared` to stop being a stupid keyword that nobody uses, and start bringing in value to the language. At the moment, the compiler happily allows you to write and read

Re: Shared - Another Thread

2018-10-17 Thread Stanislav Blinov via Digitalmars-d
On Wednesday, 17 October 2018 at 21:29:07 UTC, Stefan Koch wrote: in any case it would certainly mess up the state of everyone involved; which is exactly what happens win multi-threaded situations. ^ that is very true. And that is why: - one must not keep shared and local data close

Re: Shared - Another Thread

2018-10-17 Thread Stefan Koch via Digitalmars-d
On Wednesday, 17 October 2018 at 21:12:49 UTC, Stefan Koch wrote: [another person] cannot actually occupy the same space. It is physically impossible. Actually, that's not quite true, If they were to try hard enough the result would be nuclear fusion, (I am guessing (I am not a phsysist)),