Re: shared - i need it to be useful

2018-10-22 Thread Manu via Digitalmars-d
On Mon, Oct 22, 2018 at 6:00 AM Timon Gehr via Digitalmars-d wrote: > > On 22.10.18 12:26, Timon Gehr wrote: > > --- > > module borked; > > > > void atomicIncrement(int* p)@system{ > > import core.atomic; > > atomicOp!("+=",int,int)(*cast(shared(int)*)p,1); > > } > > > > struct Atomic(T)

Re: shared - i need it to be useful

2018-10-22 Thread Manu via Digitalmars-d
On Mon, Oct 22, 2018 at 4:50 AM Stanislav Blinov via Digitalmars-d wrote: > > On Monday, 22 October 2018 at 00:22:19 UTC, Manu wrote: > > > No no, they're repeated, not scattered, because I seem to have > > to keep repeating it over and over, because nobody is reading > > the text, or perhaps imag

Re: shared - i need it to be useful

2018-10-22 Thread Manu via Digitalmars-d
On Mon, Oct 22, 2018 at 3:30 AM Timon Gehr via Digitalmars-d wrote: > > On 22.10.18 02:54, Manu wrote: > > On Sun, Oct 21, 2018 at 5:40 PM Timon Gehr via Digitalmars-d > > wrote: > >> > >> On 21.10.18 21:04, Manu wrote: > >>> On Sun, Oct 21, 2018 at 12:00 PM Timon Gehr via Digitalmars-d > >>> wr

Re: shared - i need it to be useful

2018-10-22 Thread Manu via Digitalmars-d
On Mon, Oct 22, 2018 at 2:30 AM Walter Bright via Digitalmars-d wrote: > > On 10/22/2018 1:34 AM, Manu wrote: > > I posted it, twice... 2 messages, back to back, and you're responding > > to this one, and not that one. I'll post it again... > > > Posting it over and over is illustrative of the fai

Re: Manu's `shared` vs the @trusted promise

2018-10-22 Thread Manu via Digitalmars-d
On Mon, Oct 22, 2018 at 2:21 AM ag0aep6g via Digitalmars-d wrote: > > On 22.10.18 10:39, Simen Kjærås wrote: > > On Sunday, 21 October 2018 at 22:03:00 UTC, ag0aep6g wrote: > [...] > > It's invalid only if Atomic.badboy exists. > > I don't agree. I prefer the stronger @trusted. As far as I know, t

Re: Manu's `shared` vs the @trusted promise

2018-10-22 Thread Manu via Digitalmars-d
On Sun, Oct 21, 2018 at 3:05 PM ag0aep6g via Digitalmars-d wrote: > > It took me a while to understand Manu's idea for `shared`, and I suspect > that it was/is the same for others. At the same time, Manu seems > bewildered about the objections. I'm going to try and summarize the > situation. Maybe

Re: shared - i need it to be useful

2018-10-22 Thread Manu via Digitalmars-d
On Mon, Oct 22, 2018 at 12:55 AM Walter Bright via Digitalmars-d wrote: > > On 10/21/2018 11:58 AM, Timon Gehr wrote: > > [...] > > Thank you, Timon, for a nice explanation of what I was trying to express. You removed whatever comment you're referring to. I don't understand any of Timon's posts i

Re: shared - i need it to be useful

2018-10-22 Thread Manu via Digitalmars-d
Third time's the charm maybe? - repeated, 3rd time On Sun., 21 Oct. 2018, 2:55 am Walter Bright via Digitalmars-d, wrote: > > On 10/20/2018 11:24 AM, Manu wrote: > > This is an unfair dismissal. > > It has nothing at all to do with fairness. It is

Re: shared - i need it to be useful

2018-10-22 Thread Manu via Digitalmars-d
On Mon, Oct 22, 2018 at 12:50 AM Walter Bright via Digitalmars-d wrote: > > On 10/21/2018 5:54 PM, Manu wrote: > > Would you please respond to my messages, and specifically, respond to > > the code that I presented to you in response to your broken example. > > Or any of my earlier fragments throu

Re: D T-Shirts

2018-10-21 Thread Manu via Digitalmars-d
On Sun, Oct 21, 2018 at 5:35 PM Mike Parker via Digitalmars-d wrote: > > On Sunday, 21 October 2018 at 20:04:02 UTC, Fleel wrote: > > It would be awesome if there were T-Shirts with D-man on them. > > I would totally buy one, and would help to support the > > foundation too... > > We've got a stor

Re: shared - i need it to be useful

2018-10-21 Thread Manu via Digitalmars-d
On Sun, Oct 21, 2018 at 5:55 PM Timon Gehr via Digitalmars-d wrote: > > On 22.10.18 02:45, Manu wrote: > > On Sun, Oct 21, 2018 at 5:35 PM Timon Gehr via Digitalmars-d > > wrote: > >> > >> On 21.10.18 20:46, Manu wrote: > Shared data is only useful if, at some point, it is read/written, > >

Re: shared - i need it to be useful

2018-10-21 Thread Manu via Digitalmars-d
On Sun, Oct 21, 2018 at 5:40 PM Timon Gehr via Digitalmars-d wrote: > > On 21.10.18 21:04, Manu wrote: > > On Sun, Oct 21, 2018 at 12:00 PM Timon Gehr via Digitalmars-d > > wrote: > >> > >> On 21.10.18 17:54, Nicholas Wilson wrote: > >>> > As soon as that is done, you've got a data race with

Re: shared - i need it to be useful

2018-10-21 Thread Manu via Digitalmars-d
On Sun, Oct 21, 2018 at 5:50 PM Walter Bright via Digitalmars-d wrote: > > On 10/21/2018 4:12 PM, Nicholas Wilson wrote: > > On Sunday, 21 October 2018 at 21:32:14 UTC, Walter Bright wrote: > >> On 10/21/2018 2:08 PM, Walter Bright wrote: > >>> On 10/21/2018 12:20 PM, Nicholas Wilson wrote: >

Re: shared - i need it to be useful

2018-10-21 Thread Manu via Digitalmars-d
On Sun, Oct 21, 2018 at 5:35 PM Timon Gehr via Digitalmars-d wrote: > > On 21.10.18 20:46, Manu wrote: > >> Shared data is only useful if, at some point, it is read/written, > >> presumably by > >> casting it to unshared in @trusted code. As soon as that is done, you've > >> got a > >> data race

Re: shared - i need it to be useful

2018-10-21 Thread Manu via Digitalmars-d
On Sun, Oct 21, 2018 at 3:15 PM Neia Neutuladh via Digitalmars-d wrote: > > On Sun, 21 Oct 2018 12:04:16 -0700, Manu wrote: > > On Sun, Oct 21, 2018 at 12:00 PM Timon Gehr via Digitalmars-d > > wrote: > >> Note that there may well be a good way to get the good properties of MP > >> without breaki

Re: shared - i need it to be useful

2018-10-21 Thread Manu via Digitalmars-d
On Sun, Oct 21, 2018 at 2:35 PM Walter Bright via Digitalmars-d wrote: > > On 10/21/2018 2:08 PM, Walter Bright wrote: > > On 10/21/2018 12:20 PM, Nicholas Wilson wrote: > >> Yes, but the problem you describe is arises from implicit conversion in the > >> other direction, which is not part of the

Re: shared - i need it to be useful

2018-10-21 Thread Manu via Digitalmars-d
On Sun, Oct 21, 2018 at 11:31 AM Manu wrote: > > On Sun., 21 Oct. 2018, 2:55 am Walter Bright via Digitalmars-d, > wrote: > > > > On 10/20/2018 11:24 AM, Manu wrote: > > > This is an unfair dismissal. > > > > It has nothing at all to do with fairness. It is about what the type system > > guarante

Re: D T-Shirts

2018-10-21 Thread Manu via Digitalmars-d
On Sun., 21 Oct. 2018, 1:05 pm Fleel via Digitalmars-d, < digitalmars-d@puremagic.com> wrote: > It would be awesome if there were T-Shirts with D-man on them. I > would totally buy one, and would help to support the foundation > too... > Lucky for you, they exist, and you can acquire one by suppo

Re: shared - i need it to be useful

2018-10-21 Thread Manu via Digitalmars-d
On Sun, Oct 21, 2018 at 5:50 AM Stanislav Blinov via Digitalmars-d wrote: > > On Sunday, 21 October 2018 at 05:47:14 UTC, Manu wrote: > > >> And yet, if we're lucky, we get > >> a consistent instacrash. If we're unlucky, we get memory > >> corruption, or an unsolicited write to another currently o

Re: shared - i need it to be useful

2018-10-21 Thread Manu via Digitalmars-d
On Sun, Oct 21, 2018 at 12:00 PM Timon Gehr via Digitalmars-d wrote: > > On 21.10.18 17:54, Nicholas Wilson wrote: > > > >> As soon as that is done, you've got a data race with the other > >> existing unshared aliases. > > > > You're in @trusted code, that is the whole point. The onus is on the >

Re: shared - i need it to be useful

2018-10-21 Thread Manu via Digitalmars-d
On Sun, Oct 21, 2018 at 3:00 AM Walter Bright via Digitalmars-d wrote: > > On 10/20/2018 11:08 AM, Nicholas Wilson wrote: > > You can if no-one else writes to it, which is the whole point of Manu's > > proposal. Perhaps it should be const shared instead of shared but still. > > There is no purpose

Re: shared - i need it to be useful

2018-10-21 Thread Manu via Digitalmars-d
On Sun., 21 Oct. 2018, 2:55 am Walter Bright via Digitalmars-d, wrote: > > On 10/20/2018 11:24 AM, Manu wrote: > > This is an unfair dismissal. > > It has nothing at all to do with fairness. It is about what the type system > guarantees in @safe code. To repeat, the current type system guarantees

Re: shared - i need it to be useful

2018-10-21 Thread Manu via Digitalmars-d
On Sun., 21 Oct. 2018, 2:05 am Walter Bright via Digitalmars-d, < digitalmars-d@puremagic.com> wrote: > On 10/20/2018 11:30 AM, Manu wrote: > > You can write an invalid program in any imaginable number of ways; > > that's just not an interesting discussion. > > What we're discussing is not an inva

Re: shared - i need it to be useful

2018-10-20 Thread Manu via Digitalmars-d
On Sat, Oct 20, 2018 at 10:10 AM Stanislav Blinov via Digitalmars-d wrote: > > On Saturday, 20 October 2018 at 16:48:05 UTC, Nicholas Wilson > wrote: > > On Saturday, 20 October 2018 at 09:04:17 UTC, Walter Bright > > wrote: > >> On 10/19/2018 11:18 PM, Manu wrote: > >>> The reason I ask is becaus

Re: shared - i need it to be useful

2018-10-20 Thread Manu via Digitalmars-d
On Sat, Oct 20, 2018 at 9:45 AM Stanislav Blinov via Digitalmars-d wrote: > > On Saturday, 20 October 2018 at 16:18:53 UTC, aliak wrote: > > > class C { > > void f(); > > void g() shared; > > } > > > > void t1(shared C c) { > > c.g; // ok > > c.f; // error > > } > > > > void t2(shared C c)

Re: shared - i need it to be useful

2018-10-20 Thread Manu via Digitalmars-d
On Sat, Oct 20, 2018 at 2:05 AM Walter Bright via Digitalmars-d wrote: > > On 10/19/2018 11:18 PM, Manu wrote: > > The reason I ask is because, by my definition, if you have: > > int* a; > > shared(int)* b = a; > > > > While you have 2 numbers that address the same data, it is not actually > > al

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 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 > > with

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 > > with

Re: shared - i need it to be useful

2018-10-19 Thread Manu via Digitalmars-d
On Fri, Oct 19, 2018 at 9:45 AM Steven Schveighoffer via Digitalmars-d wrote: > > On 10/18/18 9:09 PM, Manu wrote: > > On Thu, Oct 18, 2018 at 5:30 PM Timon Gehr via Digitalmars-d > > wrote: > >> > >> On 18.10.18 23:34, Erik van Velzen wrote: > >>> If you have an object which can be used in both

Re: shared - i need it to be useful

2018-10-19 Thread Manu via Digitalmars-d
On Fri., 19 Oct. 2018, 3:10 am Walter Bright via Digitalmars-d, < digitalmars-d@puremagic.com> wrote: > On 10/17/2018 12:20 AM, Manu wrote: > > What does it mean 'aliased' precisely? > > Aliasing means there are two paths to the same piece of data. That could > be two > pointers pointing to the sa

Re: Shared - Another Thread

2018-10-19 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 declaratio

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 wrot

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 lac

Re: shared - i need it to be useful

2018-10-19 Thread Manu via Digitalmars-d
On Fri., 19 Oct. 2018, 6:10 am Dominikus Dittes Scherkl via Digitalmars-d, < digitalmars-d@puremagic.com> wrote: > On Friday, 19 October 2018 at 06:25:00 UTC, rikki cattermole > wrote: > > On 19/10/2018 7:09 PM, Norm wrote: > > > [0] > > https://github.com/rikkimax/DIPs/blob/shared/DIPs/DIP1xxx-RC

Re: shared - i need it to be useful

2018-10-18 Thread Manu via Digitalmars-d
On Thu., 18 Oct. 2018, 7:10 pm Stanislav Blinov via Digitalmars-d, < digitalmars-d@puremagic.com> wrote: > On Friday, 19 October 2018 at 01:53:00 UTC, Manu wrote: > > > This is a red-herring. > > In short, he made up this issue, it doesn't exist. > > This is just hot air, and only strengthen my co

Re: shared - i need it to be useful

2018-10-18 Thread Manu via Digitalmars-d
On Thu, Oct 18, 2018 at 6:50 PM Stanislav Blinov via Digitalmars-d wrote: > > On Friday, 19 October 2018 at 01:22:53 UTC, Manu wrote: > > On Thu, Oct 18, 2018 at 3:10 PM Simen Kjærås via Digitalmars-d > > wrote: > >> > >> > >> Now, Two very good points came up in this post, and I think > >> it's

Re: shared - i need it to be useful

2018-10-18 Thread Manu via Digitalmars-d
On Thu, Oct 18, 2018 at 3:10 PM Simen Kjærås via Digitalmars-d wrote: > > > Now, Two very good points came up in this post, and I think it's > worth stating them again, because they do present possible issues > with MP: It is easy to respond to these. > 1) How does MP deal with reorderings in no

Re: shared - i need it to be useful

2018-10-18 Thread Manu via Digitalmars-d
On Thu, Oct 18, 2018 at 5:30 PM Timon Gehr via Digitalmars-d wrote: > > On 18.10.18 23:34, Erik van Velzen wrote: > > If you have an object which can be used in both a thread-safe and a > > thread-unsafe way that's a bug or code smell. > > Then why do you not just make all members shared? Because

Re: shared - i need it to be useful

2018-10-18 Thread Manu via Digitalmars-d
On Thu, Oct 18, 2018 at 3:40 PM Steven Schveighoffer via Digitalmars-d wrote: > > On 10/18/18 5:22 PM, Manu wrote: > > On Thu, Oct 18, 2018 at 12:15 PM Steven Schveighoffer via > > Digitalmars-d wrote: > >> > >> On 10/18/18 2:55 PM, Manu wrote: > >>> On Thu, Oct 18, 2018 at 7:20 AM Steven Schveig

Re: shared - i need it to be useful

2018-10-18 Thread Manu via Digitalmars-d
On Thu, Oct 18, 2018 at 2:55 PM Stanislav Blinov via Digitalmars-d wrote: > > Manu, Erik, Simen... In what world can a person consciously say > "casting is unsafe", and yet at the same time claim that > *implicit casting* is safe? What the actual F, guys? Implicit casting exists in a world where

Re: shared - i need it to be useful

2018-10-18 Thread Manu via Digitalmars-d
On Thu, Oct 18, 2018 at 2:40 PM Erik van Velzen via Digitalmars-d wrote: > > Manu I'm also making a plea for you to write a document with your > proposal which aggregates all relevant examples and objections. > Then you can easily refer to it and we can introduce ppl to idea > without reading a me

Re: shared - i need it to be useful

2018-10-18 Thread Manu via Digitalmars-d
On Thu, Oct 18, 2018 at 1:10 PM Stanislav Blinov via Digitalmars-d wrote: > > On Thursday, 18 October 2018 at 19:51:17 UTC, Erik van Velzen > wrote: > > On Thursday, 18 October 2018 at 19:26:39 UTC, Stanislav Blinov > > >>> Manu said clearly that the receiving thread won't be able to > >>> read or

Re: shared - i need it to be useful

2018-10-18 Thread Manu via Digitalmars-d
On Thu, Oct 18, 2018 at 12:15 PM Steven Schveighoffer via Digitalmars-d wrote: > > On 10/18/18 2:55 PM, Manu wrote: > > On Thu, Oct 18, 2018 at 7:20 AM Steven Schveighoffer via Digitalmars-d > > wrote: > >> > >> On 10/18/18 10:11 AM, Simen Kjærås wrote: > >>> On Thursday, 18 October 2018 at 13:35

Re: shared - i need it to be useful

2018-10-18 Thread Manu via Digitalmars-d
On Thu, Oct 18, 2018 at 12:10 PM Steven Schveighoffer via Digitalmars-d wrote: > > On 10/18/18 2:24 PM, Manu wrote: > > I understand your argument, and I used to think this too... but I > > concluded differently for 1 simple reason: usability. > > You have not demonstrated why your proposal is usa

Re: shared - i need it to be useful

2018-10-18 Thread Manu via Digitalmars-d
On Thu, Oct 18, 2018 at 7:20 AM Steven Schveighoffer via Digitalmars-d wrote: > > On 10/18/18 10:11 AM, Simen Kjærås wrote: > > a.increment(); // unsafe, non-shared method call > > } > > > > When a.increment() is being called, you have no idea if anyone else is > > using the shared interface.

Re: shared - i need it to be useful

2018-10-18 Thread Manu via Digitalmars-d
On Thu, Oct 18, 2018 at 7:20 AM Steven Schveighoffer via Digitalmars-d wrote: > > On 10/18/18 10:11 AM, Simen Kjærås wrote: > > On Thursday, 18 October 2018 at 13:35:22 UTC, Steven Schveighoffer wrote: > >> struct ThreadSafe > >> { > >>private int x; > >>void increment() > >>{ > >>

Re: shared - i need it to be useful

2018-10-18 Thread Manu via Digitalmars-d
On Thu, Oct 18, 2018 at 6:50 AM Steven Schveighoffer via Digitalmars-d wrote: > > On 10/18/18 9:35 AM, Steven Schveighoffer wrote: > > > > struct NotThreadsafe > > { > >private int x; > >void local() > >{ > > ++x; // <- invalidates the method below, you violate the other > > funct

Re: shared - i need it to be useful

2018-10-18 Thread Manu via Digitalmars-d
On Thu, Oct 18, 2018 at 6:40 AM Steven Schveighoffer via Digitalmars-d wrote: > > On 10/17/18 10:26 PM, Manu wrote: > > On Wed, Oct 17, 2018 at 6:50 PM Steven Schveighoffer via Digitalmars-d > >> > >> The implicit cast means that you have to look at more than just your > >> method. You have to loo

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 b

Re: shared - i need it to be useful

2018-10-17 Thread Manu via Digitalmars-d
On Wed, Oct 17, 2018 at 5:05 AM Timon Gehr via Digitalmars-d wrote: > > [... all text ...] OMFG, I just spent about 3 hours writing a super-detailed reply to all of Timon's posts in aggregate... I clicked send... and it's gone. I don't know if this is a gmail thing, a mailing list thing... no ide

Re: shared - i need it to be useful

2018-10-17 Thread Manu via Digitalmars-d
On Wed, Oct 17, 2018 at 6:15 AM Timon Gehr via Digitalmars-d wrote: > > On 17.10.2018 14:24, Timon Gehr wrote: > > and unshared methods are only allowed to access unshared members. > > This is actually not necessary, let me reformulate: > > You want: > > - if you have a C c and a shared(C) s, type

Re: shared - i need it to be useful

2018-10-17 Thread Manu via Digitalmars-d
On Wed, Oct 17, 2018 at 6:50 PM Steven Schveighoffer via Digitalmars-d wrote: > > On 10/17/18 6:37 PM, Manu wrote: > > On Wed, Oct 17, 2018 at 12:35 PM Steven Schveighoffer via > > Digitalmars-d wrote: > >> > >> On 10/17/18 2:46 PM, Manu wrote: > >>> On Wed, Oct 17, 2018 at 10:30 AM Steven Schvei

Re: shared - i need it to be useful

2018-10-17 Thread Manu via Digitalmars-d
On Wed, Oct 17, 2018 at 5:35 PM Stanislav Blinov via Digitalmars-d wrote: > > On Wednesday, 17 October 2018 at 23:12:48 UTC, Manu wrote: > > On Wed, Oct 17, 2018 at 2:15 PM Stanislav Blinov via > > Digitalmars-d wrote: > >> > >> On Wednesday, 17 October 2018 at 19:25:33 UTC, Manu wrote: > >> > On

Re: shared - i need it to be useful

2018-10-17 Thread Manu via Digitalmars-d
On Wed, Oct 17, 2018 at 2:15 PM Stanislav Blinov via Digitalmars-d wrote: > > On Wednesday, 17 October 2018 at 19:25:33 UTC, Manu wrote: > > On Wed, Oct 17, 2018 at 12:05 PM Stanislav Blinov via > > Digitalmars-d wrote: > >> > >> On Wednesday, 17 October 2018 at 18:46:18 UTC, Manu wrote: > >> > >

Re: shared - i need it to be useful

2018-10-17 Thread Manu via Digitalmars-d
On Wed, Oct 17, 2018 at 12:35 PM Steven Schveighoffer via Digitalmars-d wrote: > > On 10/17/18 2:46 PM, Manu wrote: > > On Wed, Oct 17, 2018 at 10:30 AM Steven Schveighoffer via > > >> What the example demonstrates is that while you are trying to disallow > >> implicit casting of a shared pointer

Re: shared - i need it to be useful

2018-10-17 Thread Manu via Digitalmars-d
On Wed, Oct 17, 2018 at 12:05 PM Stanislav Blinov via Digitalmars-d wrote: > > On Wednesday, 17 October 2018 at 18:46:18 UTC, Manu wrote: > > > I've said this a bunch of times, there are 2 rules: > > 1. shared inhibits read and write access to members > > 2. `shared` methods must be threadsafe > >

Re: shared - i need it to be useful

2018-10-17 Thread Manu via Digitalmars-d
On Wed, Oct 17, 2018 at 10:30 AM Steven Schveighoffer via Digitalmars-d wrote: > > On 10/17/18 12:27 PM, Nicholas Wilson wrote: > > On Wednesday, 17 October 2018 at 15:51:04 UTC, Steven Schveighoffer wrote: > >> On 10/17/18 9:58 AM, Nicholas Wilson wrote: > >>> On Wednesday, 17 October 2018 at 13:

Re: shared - i need it to be useful

2018-10-17 Thread Manu via Digitalmars-d
On Tue, Oct 16, 2018 at 10:45 PM Walter Bright via Digitalmars-d wrote: > > On 10/15/2018 11:46 AM, Manu wrote: > > [...] > > Shared has one incredibly valuable feature - it allows you, the programmer, to > identify data that can be accessed by multiple threads. There are so many ways > that data

Re: shared - i need it to be useful

2018-10-16 Thread Manu via Digitalmars-d
On Tue, Oct 16, 2018 at 8:20 PM Isaac S. via Digitalmars-d wrote: > > On Tuesday, 16 October 2018 at 06:21:22 UTC, Manu wrote: > > On Mon, Oct 15, 2018 at 8:55 PM Isaac S. via Digitalmars-d > > wrote: > >> > >> On Tuesday, 16 October 2018 at 02:26:04 UTC, Manu wrote: > >> >> I understand your poi

Re: shared - i need it to be useful

2018-10-16 Thread Manu via Digitalmars-d
On Tue, Oct 16, 2018 at 3:25 PM Nicholas Wilson via Digitalmars-d wrote: > > On Tuesday, 16 October 2018 at 21:19:26 UTC, Steven Schveighoffer > wrote: > > There is in fact, no difference between: > > > > int *p; > > shared int *p2 = p; > > int *p3 = cast(int*)p2; > > > > and this: > > > > int *p;

Re: shared - i need it to be useful

2018-10-16 Thread Manu via Digitalmars-d
On Tue, Oct 16, 2018 at 2:20 PM Steven Schveighoffer via Digitalmars-d wrote: > > On 10/16/18 4:26 PM, Manu wrote: > > On Tue, Oct 16, 2018 at 11:30 AM Steven Schveighoffer via > > Digitalmars-d wrote: > >> > >> On 10/16/18 2:10 PM, Manu wrote: > >>> On Tue, Oct 16, 2018 at 6:35 AM Steven Schveig

Re: shared - i need it to be useful

2018-10-16 Thread Manu via Digitalmars-d
On Tue, Oct 16, 2018 at 11:30 AM Steven Schveighoffer via Digitalmars-d wrote: > > On 10/16/18 2:10 PM, Manu wrote: > > On Tue, Oct 16, 2018 at 6:35 AM Steven Schveighoffer via Digitalmars-d > > wrote: > >> > >> On 10/16/18 9:25 AM, Steven Schveighoffer wrote: > >>> On 10/15/18 2:46 PM, Manu wrot

Re: shared - i need it to be useful

2018-10-16 Thread Manu via Digitalmars-d
On Tue, Oct 16, 2018 at 6:35 AM Steven Schveighoffer via Digitalmars-d wrote: > > On 10/16/18 9:25 AM, Steven Schveighoffer wrote: > > On 10/15/18 2:46 PM, Manu wrote: > > >>> From there, it opens up another critical opportunity; T* -> shared(T)* > >> promotion. > >> Const would be useless without

Re: shared - i need it to be useful

2018-10-16 Thread Manu via Digitalmars-d
On Tue, Oct 16, 2018 at 6:25 AM Timon Gehr via Digitalmars-d wrote: > > On 16.10.2018 13:04, Dominikus Dittes Scherkl wrote: > > On Tuesday, 16 October 2018 at 10:15:51 UTC, Timon Gehr wrote: > >> On 15.10.2018 20:46, Manu wrote: > >>> > >>> Assuming the rules above: "can't read or write to member

Re: shared - i need it to be useful

2018-10-16 Thread Manu via Digitalmars-d
On Tue, Oct 16, 2018 at 3:20 AM Timon Gehr via Digitalmars-d wrote: > > On 15.10.2018 20:46, Manu wrote: > > > > Assuming the rules above: "can't read or write to members", and the > > understanding that `shared` methods are expected to have threadsafe > > implementations (because that's the whole

Re: shared - i need it to be useful

2018-10-16 Thread Manu via Digitalmars-d
On Tue, Oct 16, 2018 at 2:25 AM Kagamin via Digitalmars-d wrote: > > On Monday, 15 October 2018 at 18:46:45 UTC, Manu wrote: > > Current situation where you can arbitrarily access shared > > members > > undermines any value it has. > > The value of shared is existence of thread-local data that's >

Re: shared - i need it to be useful

2018-10-15 Thread Manu via Digitalmars-d
On Mon, Oct 15, 2018 at 8:55 PM Isaac S. via Digitalmars-d wrote: > > On Tuesday, 16 October 2018 at 02:26:04 UTC, Manu wrote: > >> I understand your point but I think the current shared (no > >> implicit conversion) has its uses. It can be quite useful to > >> have one interface for when an objec

Re: shared - i need it to be useful

2018-10-15 Thread Manu via Digitalmars-d
On Mon, Oct 15, 2018 at 7:25 PM Stanislav Blinov via Digitalmars-d wrote: > > On Tuesday, 16 October 2018 at 00:15:54 UTC, Manu wrote: > > On Mon, Oct 15, 2018 at 4:35 PM Stanislav Blinov via > > Digitalmars-d wrote: > > >> What?!? So... my unshared methods should also perform all > >> that's nec

Re: shared - i need it to be useful

2018-10-15 Thread Manu via Digitalmars-d
On Mon, Oct 15, 2018 at 7:15 PM Isaac S. via Digitalmars-d wrote: > > On Tuesday, 16 October 2018 at 00:36:12 UTC, Manu wrote: > > *snip* > > > > Yes, except maybe I didn't make it clear that I DO expect the > > un-shared methods to be aware that a sibling shared method does > > exist > > (you wro

Re: shared - i need it to be useful

2018-10-15 Thread Manu via Digitalmars-d
On Mon, Oct 15, 2018 at 5:10 PM Nicholas Wilson via Digitalmars-d wrote: > > On Monday, 15 October 2018 at 23:30:43 UTC, Stanislav Blinov > wrote: > > On Monday, 15 October 2018 at 21:51:43 UTC, Manu wrote: > > > >> I see it this way: > >> If your object has shared methods, then it is distinctly a

Re: shared - i need it to be useful

2018-10-15 Thread Manu via Digitalmars-d
On Mon, Oct 15, 2018 at 4:35 PM Stanislav Blinov via Digitalmars-d wrote: > > On Monday, 15 October 2018 at 21:51:43 UTC, Manu wrote: > > > If a shared method is incompatible with an unshared method, > > your class is broken. > > What?!? So... my unshared methods should also perform all that's > n

Re: shared - i need it to be useful

2018-10-15 Thread Manu via Digitalmars-d
On Mon, Oct 15, 2018 at 4:25 PM Peter Alexander via Digitalmars-d wrote: > > On Monday, 15 October 2018 at 20:53:32 UTC, Manu wrote: > > On Mon, Oct 15, 2018 at 1:05 PM Peter Alexander via > > Digitalmars-d wrote: > >> > >> On Monday, 15 October 2018 at 18:46:45 UTC, Manu wrote: > >> 1. A single

Re: shared - i need it to be useful

2018-10-15 Thread Manu via Digitalmars-d
On Mon, Oct 15, 2018 at 2:25 PM Stanislav Blinov via Digitalmars-d wrote: > > On Monday, 15 October 2018 at 20:57:46 UTC, Manu wrote: > > On Mon, Oct 15, 2018 at 1:15 PM Stanislav Blinov via > > Digitalmars-d wrote: > >> > >> On Monday, 15 October 2018 at 18:46:45 UTC, Manu wrote: > >> > >> > Ass

Re: shared - i need it to be useful

2018-10-15 Thread Manu via Digitalmars-d
On Mon, Oct 15, 2018 at 2:05 PM Nicholas Wilson via Digitalmars-d wrote: > > On Monday, 15 October 2018 at 20:54:12 UTC, jmh530 wrote: > > On Monday, 15 October 2018 at 20:44:35 UTC, Manu wrote: > >> snip > >> > >> Are you saying `is(immutable(int) == shared) == true)` ?? > > > > From the spec: >

Re: shared - i need it to be useful

2018-10-15 Thread Manu via Digitalmars-d
On Mon, Oct 15, 2018 at 1:15 PM Stanislav Blinov via Digitalmars-d wrote: > > On Monday, 15 October 2018 at 18:46:45 UTC, Manu wrote: > > > Assuming the rules above: "can't read or write to members", and > > the understanding that `shared` methods are expected to have > > threadsafe implementation

Re: shared - i need it to be useful

2018-10-15 Thread Manu via Digitalmars-d
On Mon, Oct 15, 2018 at 1:05 PM Peter Alexander via Digitalmars-d wrote: > > On Monday, 15 October 2018 at 18:46:45 UTC, Manu wrote: > > Destroy... > > What you describe sounds better than what we currently have. > > I have at least two concerns: > > 1. A single producer, single consumer (SPSC) qu

Re: shared - i need it to be useful

2018-10-15 Thread Manu via Digitalmars-d
On Mon, Oct 15, 2018 at 12:45 PM Nicholas Wilson via Digitalmars-d wrote: > > On Monday, 15 October 2018 at 18:46:45 UTC, Manu wrote: > > Destroy... > > Keep in mind immutable is implicitly shared (i.e. not in tls) > because nobody can change it. It should stay readable for this > reason. Are you

Re: shared - i need it to be useful

2018-10-15 Thread Manu via Digitalmars-d
On Mon, Oct 15, 2018 at 12:15 PM Peter Alexander via Digitalmars-d wrote: > > On Monday, 15 October 2018 at 18:46:45 UTC, Manu wrote: > > 2. object may have shared methods; such methods CAN be called on > > shared instances. such methods may internally implement > > synchronisation to perform thei

Re: shared - i need it to be useful

2018-10-15 Thread Manu via Digitalmars-d
On Mon, Oct 15, 2018 at 12:15 PM Peter Alexander via Digitalmars-d wrote: > > On Monday, 15 October 2018 at 18:46:45 UTC, Manu wrote: > > 2. object may have shared methods; such methods CAN be called on > > shared instances. such methods may internally implement > > synchronisation to perform thei

shared - i need it to be useful

2018-10-15 Thread Manu via Digitalmars-d
Okay, so I've been thinking on this for a while... I think I have a pretty good feel for how shared is meant to be. 1. shared should behave exactly like const, except in addition to inhibiting write access, it also inhibits read access. I think this is the foundation for a useful definition for s

Re: Thread-safe attribution

2018-10-07 Thread Manu via Digitalmars-d
On Sun, Oct 7, 2018 at 10:00 AM Boris-Barboris via Digitalmars-d wrote: > > On Sunday, 7 October 2018 at 02:01:17 UTC, Manu wrote: > > ... but I'm really struggling > > to express it in terms of the type system... > > I'm pretty sure no simple attribute system is any more useful > than current con

Re: Thread-safe attribution

2018-10-06 Thread Manu via Digitalmars-d
On Sat, Oct 6, 2018 at 8:10 PM Stanislav Blinov via Digitalmars-d wrote: > > On Sunday, 7 October 2018 at 02:01:17 UTC, Manu wrote: > > >> The thing I'm trying to model is an attribute along the lines > >> of > >> `shared`, but actually useful ;) > >> I'll use the attribute `threadsafe` in place o

Re: Thread-safe attribution

2018-10-06 Thread Manu via Digitalmars-d
On Sat, Oct 6, 2018 at 7:01 PM Manu wrote: > > On Sat, Oct 6, 2018 at 6:59 PM Manu wrote: > > > > So I'm working on a SMT infrastructure, and expression of > > thread-safety is a core design mechanic... but I'm really struggling > > to express it in terms of the type system. > > I figure I'll thr

Re: Thread-safe attribution

2018-10-06 Thread Manu via Digitalmars-d
On Sat, Oct 6, 2018 at 7:40 PM Nicholas Wilson via Digitalmars-d wrote: > > [...] > > One thing that occurred to me is that _objects_ are shared, > whereas _functions/methods_ (and their parameters) are thread > safe . > > Theadsafe is kind of like a const (as to mutable/immutable) to > threading,

Re: Thread-safe attribution

2018-10-06 Thread Manu via Digitalmars-d
On Sat, Oct 6, 2018 at 6:59 PM Manu wrote: > > So I'm working on a SMT infrastructure, and expression of > thread-safety is a core design mechanic... but I'm really struggling > to express it in terms of the type system. > I figure I'll throw some design challenges out here and see if anyone > can

Thread-safe attribution

2018-10-06 Thread Manu via Digitalmars-d
So I'm working on a SMT infrastructure, and expression of thread-safety is a core design mechanic... but I'm really struggling to express it in terms of the type system. I figure I'll throw some design challenges out here and see if anyone can offer some good ideas. The thing I'm trying to model i

Re: DIP 1014

2018-10-03 Thread Manu via Digitalmars-d
On Wed, Oct 3, 2018 at 11:00 PM Timothee Cour via Digitalmars-d wrote: > > @Manu, @Jonathan M Davis > > > GNU's std::string implementation stores an interior pointer! >_< > > it's not just GNU's std::string ; it can crop up in other places, see > https://github.com/Syniurge/Calypso/issues/70 in op

Re: DIP 1014

2018-10-03 Thread Manu via Digitalmars-d
On Wed, Oct 3, 2018 at 7:00 AM Stanislav Blinov via Digitalmars-d wrote: > > Shachar, as I don't see a better place of discussing that DIP at > the moment, I'll pour some observations and thoughts in here if > you don't mind, will add some comments on GitHub later. > As I see it right now, it's a

Re: DIP 1014

2018-10-03 Thread Manu via Digitalmars-d
On Wed, Oct 3, 2018 at 2:50 AM Corel via Digitalmars-d wrote: > > On Wednesday, 3 October 2018 at 08:21:38 UTC, Manu wrote: > > On Tue, Oct 2, 2018 at 6:15 PM Walter Bright via Digitalmars-d > > wrote: > >> > >> On 10/2/2018 4:30 PM, Adam D. Ruppe wrote: > >> > On Tuesday, 2 October 2018 at 22:30

Re: DIP 1014

2018-10-03 Thread Manu via Digitalmars-d
On Tue, Oct 2, 2018 at 6:15 PM Walter Bright via Digitalmars-d wrote: > > On 10/2/2018 4:30 PM, Adam D. Ruppe wrote: > > On Tuesday, 2 October 2018 at 22:30:38 UTC, Jonathan M Davis wrote: > >> Yeah. IIRC, it was supposed to be _guaranteed_ that the compiler moved > >> structs > >> in a number of

Re: `shared`...

2018-10-02 Thread Manu via Digitalmars-d
On Tue, Oct 2, 2018 at 12:45 AM Walter Bright via Digitalmars-d wrote: > > On 10/1/2018 7:31 PM, Manu wrote: > > Surely `scope` must be transitive? > > It isn't. > > > How could it work otherwise? > > It's a storage class, not a type constructor. There is no "pointer to scope" > type, for example.

Re: DIP 1014

2018-10-02 Thread Manu via Digitalmars-d
On Tue, Oct 2, 2018 at 2:40 AM Walter Bright via Digitalmars-d wrote: > > On 10/2/2018 2:17 AM, Walter Bright wrote: > > 1. Don't allow moving of C++ structs > > 2. Add a struct attribute that means "not moveable" > > 3. DIP 1014, which is add a __move_post_blit() function (most complex > > solut

Re: DIP 1014

2018-10-02 Thread Manu via Digitalmars-d
On Tue, Oct 2, 2018 at 2:20 AM Walter Bright via Digitalmars-d wrote: > > On 9/29/2018 9:34 PM, Manu wrote: > > Who knows about DIP 1014? (struct move hook) > > Is it well received? Is it likely to be accepted soon? > > > > I'm working on the std::string binding, it's almost finished... but > > th

Re: `shared`...

2018-10-01 Thread Manu via Digitalmars-d
On Mon, Oct 1, 2018 at 5:00 PM Timon Gehr via Digitalmars-d wrote: > > On 02.10.2018 01:09, Manu wrote: > > Your entire example depends on escaping references. I think you missed > > the point? > > There was no 'scope' in the OP, and no, that is not sufficient either, > because scope is not transi

Re: `shared`...

2018-10-01 Thread Manu via Digitalmars-d
On Mon, Oct 1, 2018 at 11:45 AM deadalnix via Digitalmars-d wrote: > > On Monday, 1 October 2018 at 02:29:40 UTC, Manu wrote: > > I feel like I don't understand the design... > > mutable -> shared should work the same as mutable -> const... > > because > > surely that's safe? > > > > Nope. Conside

Re: `shared`...

2018-10-01 Thread Manu via Digitalmars-d
On Mon, Oct 1, 2018 at 8:55 AM Timon Gehr via Digitalmars-d wrote: > > On 01.10.2018 04:29, Manu wrote: > > struct Bob > > { > >void setThing() shared; > > } > > > > As I understand, `shared` attribution intends to guarantee that I dun > > synchronisation internally. > > This method is declare

Re: `shared`...

2018-10-01 Thread Manu via Digitalmars-d
On Mon, Oct 1, 2018 at 3:51 AM Jonathan M Davis via Digitalmars-d wrote: > > pure is not sufficient regardless of what happens with threads, [..] #truefacts > Certainly, it's way, way simply just to use scope and force > the programmer to continue to cast in those cases that the compiler can't >

Re: `shared`...

2018-09-30 Thread Manu via Digitalmars-d
On Sun, Sep 30, 2018 at 9:00 PM Nicholas Wilson via Digitalmars-d wrote: > > On Monday, 1 October 2018 at 03:33:16 UTC, Manu wrote: > > On Sun, Sep 30, 2018 at 8:20 PM Nicholas Wilson via > > Digitalmars-d wrote: > >> > >> On Monday, 1 October 2018 at 02:29:40 UTC, Manu wrote: > >> > struct Bob >

Re: `shared`...

2018-09-30 Thread Manu via Digitalmars-d
On Sun, Sep 30, 2018 at 8:20 PM Nicholas Wilson via Digitalmars-d wrote: > > On Monday, 1 October 2018 at 02:29:40 UTC, Manu wrote: > > struct Bob > > { > > void setThing() shared; > > } > > > > As I understand, `shared` attribution intends to guarantee that > > I dun > > synchronisation interna

  1   2   3   4   5   6   7   8   9   10   >