Re: Ownership semantics

2016-01-31 Thread Matt Elkins via Digitalmars-d-learn
On Sunday, 31 January 2016 at 20:20:52 UTC, Steven Schveighoffer wrote: Oh, nevermind. This is actually simpler. You can't do memory operations inside a destructor during collection. I forgot about that. But the rule I stated is still in force. -Steve So this implies that the UniquePtr imp

Re: Ownership semantics

2016-01-31 Thread maik klein via Digitalmars-d-learn
On Sunday, 31 January 2016 at 20:20:52 UTC, Steven Schveighoffer wrote: On 1/31/16 3:15 PM, Matt Elkins wrote: On Sunday, 31 January 2016 at 20:11:07 UTC, Matt Elkins wrote: On Sunday, 31 January 2016 at 20:10:03 UTC, Matt Elkins wrote: On Sunday, 31 January 2016 at 20:07:26 UTC, Steven Schvei

Re: Ownership semantics

2016-01-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/31/16 3:15 PM, Matt Elkins wrote: On Sunday, 31 January 2016 at 20:11:07 UTC, Matt Elkins wrote: On Sunday, 31 January 2016 at 20:10:03 UTC, Matt Elkins wrote: On Sunday, 31 January 2016 at 20:07:26 UTC, Steven Schveighoffer wrote: What is likely happening is that ptr is already collected

Re: Ownership semantics

2016-01-31 Thread Matt Elkins via Digitalmars-d-learn
On Sunday, 31 January 2016 at 20:11:07 UTC, Matt Elkins wrote: On Sunday, 31 January 2016 at 20:10:03 UTC, Matt Elkins wrote: On Sunday, 31 January 2016 at 20:07:26 UTC, Steven Schveighoffer wrote: What is likely happening is that ptr is already collected, and you are invalidly attempting to re

Re: Ownership semantics

2016-01-31 Thread Matt Elkins via Digitalmars-d-learn
On Sunday, 31 January 2016 at 20:10:03 UTC, Matt Elkins wrote: On Sunday, 31 January 2016 at 20:07:26 UTC, Steven Schveighoffer wrote: What is likely happening is that ptr is already collected, and you are invalidly attempting to re-free it. The GC can collect this memory even though there is

Re: Ownership semantics

2016-01-31 Thread Matt Elkins via Digitalmars-d-learn
On Sunday, 31 January 2016 at 20:07:26 UTC, Steven Schveighoffer wrote: What is likely happening is that ptr is already collected, and you are invalidly attempting to re-free it. The GC can collect this memory even though there is still an outstanding root-reachable pointer to it?

Re: Ownership semantics

2016-01-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/31/16 2:34 PM, maik klein wrote: I recently asked a question about ownership semantics in D https://stackoverflow.com/questions/35115702/how-do-i-express-ownership-semantics-in-d But a few minutes ago I found an answer on SO that could potentially explain a lot. http://stackoverflow.com

Re: Ownership semantics

2016-01-31 Thread Matt Elkins via Digitalmars-d-learn
On Sunday, 31 January 2016 at 19:34:43 UTC, maik klein wrote: I recently asked a question about ownership semantics in D https://stackoverflow.com/questions/35115702/how-do-i-express-ownership-semantics-in-d But a few minutes ago I found an answer on SO that could potentially explain a lot

Ownership semantics

2016-01-31 Thread maik klein via Digitalmars-d-learn
I recently asked a question about ownership semantics in D https://stackoverflow.com/questions/35115702/how-do-i-express-ownership-semantics-in-d But a few minutes ago I found an answer on SO that could potentially explain a lot. http://stackoverflow.com/a/35114945/944430 Sadly it has some