Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-05-07 Thread Stanislav Blinov via Digitalmars-d
On Sunday, 7 May 2017 at 11:46:33 UTC, Andrei Alexandrescu wrote: On 5/7/17 1:30 PM, Stanislav Blinov wrote: To follow this discussion up, and in light of yesterday's Collections presentation at DConf, I though I'd go ahead and make a basic implementation of traits-based IAllocator. You

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-05-07 Thread Andrei Alexandrescu via Digitalmars-d
On 5/7/17 1:30 PM, Stanislav Blinov wrote: To follow this discussion up, and in light of yesterday's Collections presentation at DConf, I though I'd go ahead and make a basic implementation of traits-based IAllocator. You can find it here: https://github.com/radcapricorn/alloctraits

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-05-07 Thread Stanislav Blinov via Digitalmars-d
On Monday, 1 May 2017 at 13:00:27 UTC, Andrei Alexandrescu wrote: On 05/01/2017 08:12 AM, Guillaume Piolat wrote: On Sunday, 30 April 2017 at 21:43:26 UTC, Andrei Alexandrescu wrote: A pass through the root allocators (Mallocator, GCAllocator etc) figuring out what attributes could be

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-05-02 Thread Atila Neves via Digitalmars-d
On Monday, 1 May 2017 at 07:42:19 UTC, Sebastiaan Koppe wrote: On Friday, 28 April 2017 at 22:18:54 UTC, Atila Neves wrote: Done. I also added to the README that it has its own versions of the range constraints from Phobos that can be used with `@models`. Atila Example of an error message

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-05-02 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 05/01/2017 10:51 PM, Stanislav Blinov wrote: On Monday, 1 May 2017 at 16:31:10 UTC, Nick Sabalausky (Abscissa) wrote: If we had a type similar to TaggedAlgebraic... Destroy? It's too strict: you have to specify concrete types beforehand. No, that's why my suggestion was: "If we had a

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-05-01 Thread Stanislav Blinov via Digitalmars-d
On Tuesday, 2 May 2017 at 02:51:02 UTC, Stanislav Blinov wrote: Lost one else. Should be static if (traits & (AllocatorTraits.sharedInstance | AllocatorTraits.noGC)) @nogc shared { mixin AllocatorInterface!(); } else static if (traits &

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-05-01 Thread Stanislav Blinov via Digitalmars-d
On Monday, 1 May 2017 at 16:31:10 UTC, Nick Sabalausky (Abscissa) wrote: If we had a type similar to TaggedAlgebraic... Destroy? It's too strict: you have to specify concrete types beforehand. This spills over into user code and makes it far less versatile that can be achieved. Currently

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-05-01 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 04/30/2017 05:39 PM, Andrei Alexandrescu wrote: The allocators design is interesting in that it has a full DbI core, on top of which resides a thin dynamically-type interface (IAllocator and ISharedAllocator). We're still exploring the idioms enabled by this interaction. -- Andrei I assume

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-05-01 Thread Andrei Alexandrescu via Digitalmars-d
On 05/01/2017 08:12 AM, Guillaume Piolat wrote: On Sunday, 30 April 2017 at 21:43:26 UTC, Andrei Alexandrescu wrote: A pass through the root allocators (Mallocator, GCAllocator etc) figuring out what attributes could be meaningfully attached would be welcome. The rest would rely on inference.

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-05-01 Thread Guillaume Piolat via Digitalmars-d
On Sunday, 30 April 2017 at 21:43:26 UTC, Andrei Alexandrescu wrote: A pass through the root allocators (Mallocator, GCAllocator etc) figuring out what attributes could be meaningfully attached would be welcome. The rest would rely on inference. Thanks, Andrei IAllocator being fully

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-05-01 Thread Stanislav Blinov via Digitalmars-d
On Monday, 1 May 2017 at 04:54:28 UTC, Andrei Alexandrescu wrote: On 4/30/17 8:43 PM, Stanislav Blinov wrote: On Sunday, 30 April 2017 at 21:43:26 UTC, Andrei Alexandrescu wrote: On 04/27/2017 07:35 PM, Stanislav Blinov wrote: IAllocator is too high level an interface, it doesn't carry any

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-05-01 Thread Sebastiaan Koppe via Digitalmars-d
On Friday, 28 April 2017 at 22:18:54 UTC, Atila Neves wrote: Done. I also added to the README that it has its own versions of the range constraints from Phobos that can be used with `@models`. Atila Example of an error message in the README would be great too.

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-30 Thread Andrei Alexandrescu via Digitalmars-d
On 4/30/17 8:43 PM, Stanislav Blinov wrote: On Sunday, 30 April 2017 at 21:43:26 UTC, Andrei Alexandrescu wrote: On 04/27/2017 07:35 PM, Stanislav Blinov wrote: IAllocator is too high level an interface, it doesn't carry any information as to what type of memory it can allocate (so we can only

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-30 Thread Stanislav Blinov via Digitalmars-d
On Monday, 1 May 2017 at 00:43:22 UTC, Stanislav Blinov wrote: block_ = allocator_.allocate(T.sizeof); Obviously, should be Block.sizeof, and AllocatorInterface!AllocTraits allocator_; should be AllocatorInterface!traits allocator_

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-30 Thread Stanislav Blinov via Digitalmars-d
On Sunday, 30 April 2017 at 21:43:26 UTC, Andrei Alexandrescu wrote: On 04/27/2017 07:35 PM, Stanislav Blinov wrote: IAllocator is too high level an interface, it doesn't carry any information as to what type of memory it can allocate (so we can only assume unshared), and does or does it not

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-30 Thread Andrei Alexandrescu via Digitalmars-d
On 04/27/2017 07:35 PM, Stanislav Blinov wrote: IAllocator is too high level an interface, it doesn't carry any information as to what type of memory it can allocate (so we can only assume unshared), and does or does it not use GC (so we can only assume GC). Initially all fresh memory is

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-30 Thread Andrei Alexandrescu via Digitalmars-d
On 04/27/2017 07:12 PM, Moritz Maxeiner wrote: On Thursday, 27 April 2017 at 20:04:32 UTC, Stanislav Blinov wrote: On Thursday, 27 April 2017 at 19:57:52 UTC, Andrei Alexandrescu wrote: https://github.com/dlang/phobos/pull/5355 Andrei And then we'd probably need INoGCAllocator and

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-30 Thread Andrei Alexandrescu via Digitalmars-d
On 04/27/2017 04:04 PM, Stanislav Blinov wrote: On Thursday, 27 April 2017 at 19:57:52 UTC, Andrei Alexandrescu wrote: https://github.com/dlang/phobos/pull/5355 Andrei And then we'd probably need INoGCAllocator and ISharedNOGCAllocator... "shared" is a type qualifier essentially changing

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-28 Thread Atila Neves via Digitalmars-d
On Friday, 28 April 2017 at 18:04:06 UTC, jmh530 wrote: On Friday, 28 April 2017 at 17:09:22 UTC, Atila Neves wrote: https://github.com/atilaneves/concepts import concepts; @models!(isForwardRange, MyType) struct MyType { } Atila I remember you had posted about this last year. It

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-28 Thread jmh530 via Digitalmars-d
On Friday, 28 April 2017 at 17:09:22 UTC, Atila Neves wrote: https://github.com/atilaneves/concepts import concepts; @models!(isForwardRange, MyType) struct MyType { } Atila I remember you had posted about this last year. It looks like you've added some stuff on ranges to it

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-28 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 04/28/2017 01:09 PM, Atila Neves wrote: https://github.com/atilaneves/concepts import concepts; @models!(isForwardRange, MyType) struct MyType { } Hmm, close, but if I'm reading the source right, it looks like a type doesn't have to use the UDA in order for isXXX or "static

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-28 Thread Atila Neves via Digitalmars-d
On Friday, 28 April 2017 at 01:12:39 UTC, Nick Sabalausky (Abscissa) wrote: On 04/27/2017 07:12 PM, Moritz Maxeiner wrote: Wasn't one major selling point of compile time introspection / duck typing that we could stop using interfaces such... naming schemes? Not that I speak for everyone,

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-27 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 04/27/2017 07:12 PM, Moritz Maxeiner wrote: Wasn't one major selling point of compile time introspection / duck typing that we could stop using interfaces such... naming schemes? Not that I speak for everyone, but the way I see it, no, the duck typing aspect is just something that's to be

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-27 Thread Stanislav Blinov via Digitalmars-d
On Thursday, 27 April 2017 at 23:12:48 UTC, Moritz Maxeiner wrote: On Thursday, 27 April 2017 at 20:04:32 UTC, Stanislav Blinov wrote: On Thursday, 27 April 2017 at 19:57:52 UTC, Andrei Alexandrescu wrote: https://github.com/dlang/phobos/pull/5355 Andrei And then we'd probably need

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-27 Thread Moritz Maxeiner via Digitalmars-d
On Thursday, 27 April 2017 at 20:04:32 UTC, Stanislav Blinov wrote: On Thursday, 27 April 2017 at 19:57:52 UTC, Andrei Alexandrescu wrote: https://github.com/dlang/phobos/pull/5355 Andrei And then we'd probably need INoGCAllocator and ISharedNOGCAllocator... Wasn't one major selling point

Re: Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-27 Thread Stanislav Blinov via Digitalmars-d
On Thursday, 27 April 2017 at 19:57:52 UTC, Andrei Alexandrescu wrote: https://github.com/dlang/phobos/pull/5355 Andrei And then we'd probably need INoGCAllocator and ISharedNOGCAllocator...

Interesting PRs: bringing type system legitimacy to shared allocators

2017-04-27 Thread Andrei Alexandrescu via Digitalmars-d
https://github.com/dlang/phobos/pull/5355 Andrei