Re: DIP1000: Scoped Pointers

2016-08-16 Thread Rory McGuire via Digitalmars-d-announce
On 17 Aug 2016 04:00, "Mike via Digitalmars-d-announce" < digitalmars-d-announce@puremagic.com> wrote: > > On Wednesday, 17 August 2016 at 01:42:00 UTC, Walter Bright wrote: > >>> Can you please clarify the current implementation `scope`, and what DIP1000 >>> proposes to change with respect to the

Re: DIP1000: Scoped Pointers

2016-08-16 Thread Mike via Digitalmars-d-announce
On Wednesday, 17 August 2016 at 01:42:00 UTC, Walter Bright wrote: Can you please clarify the current implementation `scope`, and what DIP1000 proposes to change with respect to the current implementation? It just adds to the existing compiler implementation of 'scope'. It has nothing to do

Re: DIP1000: Scoped Pointers

2016-08-16 Thread Walter Bright via Digitalmars-d-announce
On 8/16/2016 6:01 PM, H. S. Teoh via Digitalmars-d-announce wrote: On Wed, Aug 17, 2016 at 01:01:05AM +, Chris Wright via Digitalmars-d-announce wrote: On Tue, 16 Aug 2016 18:55:40 +, Dicebot wrote: You need to add one more level of indirection for things to start going complicated.

Re: DIP1000: Scoped Pointers

2016-08-16 Thread Walter Bright via Digitalmars-d-announce
On 8/16/2016 5:31 PM, Mike wrote: On Monday, 15 August 2016 at 04:58:06 UTC, Walter Bright wrote: On 8/14/2016 9:56 PM, Joseph Rushton Wakeling wrote: Does that actually work in D2? Yes. Can you please clarify the current implementation `scope`, and what DIP1000 proposes to change with

Re: DIP1000: Scoped Pointers

2016-08-16 Thread H. S. Teoh via Digitalmars-d-announce
On Wed, Aug 17, 2016 at 01:01:05AM +, Chris Wright via Digitalmars-d-announce wrote: > On Tue, 16 Aug 2016 18:55:40 +, Dicebot wrote: > > You need to add one more level of indirection for things to start > > going complicated. > > Presumably scope is transitive, so things shouldn't get

Re: DIP1000: Scoped Pointers

2016-08-16 Thread Chris Wright via Digitalmars-d-announce
On Tue, 16 Aug 2016 18:55:40 +, Dicebot wrote: > You need to add one more level of indirection for things to start going > complicated. Presumably scope is transitive, so things shouldn't get horribly complex.

Re: DIP1000: Scoped Pointers

2016-08-16 Thread Mike via Digitalmars-d-announce
On Monday, 15 August 2016 at 04:58:06 UTC, Walter Bright wrote: On 8/14/2016 9:56 PM, Joseph Rushton Wakeling wrote: Does that actually work in D2? Yes. Can you please clarify the current implementation `scope`, and what DIP1000 proposes to change with respect to the current

Re: DIP1000: Scoped Pointers

2016-08-16 Thread Walter Bright via Digitalmars-d-announce
On 8/16/2016 11:25 AM, Meta wrote: What about this? struct Rnd { int* state; } void test() { scope rnd = new Rnd(); Rnd rnd2 = *rnd; saveGlobalState(rnd2); } 'state' is set to null by 'new Rnd()', and so no pointers escape.

Re: Aedi - a dependency injection library

2016-08-16 Thread Rory McGuire via Digitalmars-d-announce
On 16 Aug 2016 20:45, "Alexandru Ermicioi via Digitalmars-d-announce" < digitalmars-d-announce@puremagic.com> wrote: > > On Tuesday, 16 August 2016 at 14:25:10 UTC, Jacob Carlborg wrote: >> >> On 2016-08-16 11:41, Alexandru Ermicioi wrote: >> >>> https://github.com/aermicioi/aedi >> >> >> If you

Re: DIP1000: Scoped Pointers

2016-08-16 Thread Rory McGuire via Digitalmars-d-announce
On 16 Aug 2016 21:01, "Dicebot via Digitalmars-d-announce" < digitalmars-d-announce@puremagic.com> wrote: > > On Tuesday, 16 August 2016 at 18:55:40 UTC, Dicebot wrote: >> >> On Tuesday, 16 August 2016 at 18:25:42 UTC, Meta wrote: >>> >>> What about this? >>> >>> struct Rnd >>> { >>> int*

Re: DIP1000: Scoped Pointers

2016-08-16 Thread Dicebot via Digitalmars-d-announce
On Tuesday, 16 August 2016 at 18:55:40 UTC, Dicebot wrote: On Tuesday, 16 August 2016 at 18:25:42 UTC, Meta wrote: What about this? struct Rnd { int* state; } void test() { scope rnd = new Rnd(); Rnd rnd2 = *rnd; saveGlobalState(rnd2); } Same as far as I understand, because

Re: DIP1000: Scoped Pointers

2016-08-16 Thread Dicebot via Digitalmars-d-announce
On Tuesday, 16 August 2016 at 18:25:42 UTC, Meta wrote: What about this? struct Rnd { int* state; } void test() { scope rnd = new Rnd(); Rnd rnd2 = *rnd; saveGlobalState(rnd2); } Same as far as I understand, because "from a lifetime analysis viewpoint, a struct is

Re: Aedi - a dependency injection library

2016-08-16 Thread Alexandru Ermicioi via Digitalmars-d-announce
On Tuesday, 16 August 2016 at 14:25:10 UTC, Jacob Carlborg wrote: On 2016-08-16 11:41, Alexandru Ermicioi wrote: https://github.com/aermicioi/aedi If you use: ```d ``` For the code block you'll get syntax highlighting for D. Thx, for info. Didn't know about such syntax. I'll update it

Re: DIP1000: Scoped Pointers

2016-08-16 Thread Meta via Digitalmars-d-announce
On Tuesday, 16 August 2016 at 16:34:05 UTC, Dicebot wrote: On 08/16/2016 07:26 PM, Patrick Schluter wrote: What happens in that case ? void test() { scope rnd = new Rnd; // reference semantic and stack allocated Rnd rnd2; rnd2 = rnd;

Re: DIP1000: Scoped Pointers

2016-08-16 Thread Dicebot via Digitalmars-d-announce
On 08/16/2016 07:26 PM, Patrick Schluter wrote: > What happens in that case ? > > void test() { > scope rnd = new Rnd; // reference semantic and stack allocated > Rnd rnd2; > rnd2 = rnd; > some_sneaky_function_that_saves_global_state(rnd); > } > > or is that not even possible ? (sorry

Re: DIP1000: Scoped Pointers

2016-08-16 Thread Patrick Schluter via Digitalmars-d-announce
On Monday, 15 August 2016 at 21:25:22 UTC, Walter Bright wrote: On 8/15/2016 6:54 AM, Rory McGuire via Digitalmars-d-announce wrote: okay nice, so that code would not compile but code such as: void test() { scope rnd = new Rnd; // reference semantic and stack allocated auto rnd2 = rnd;

Re: Aedi - a dependency injection library

2016-08-16 Thread Jacob Carlborg via Digitalmars-d-announce
On 2016-08-16 11:41, Alexandru Ermicioi wrote: https://github.com/aermicioi/aedi If you use: ```d ``` For the code block you'll get syntax highlighting for D. -- /Jacob Carlborg

Aedi - a dependency injection library

2016-08-16 Thread Alexandru Ermicioi via Digitalmars-d-announce
Good day. I'd like to show my library aedi (v0.0.1), which implements dependency injection pattern. They key features of aedi are: 1) Simple api through which a container can be configured with objects. 2) Ability to extend the library with custom logic required by your code. 3) Ability to