Re: MobI? Really?

2021-09-21 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 21 September 2021 at 16:14:52 UTC, Chris_D wrote: Thanks for the replies. jfondren: Sorry, but I am talking about documentation. For me, online web pages don't qualify; they are in the cloud, unreal, with no substance. Does anyone really read 300 pages online, in a web browser?

Re: Program crash: GC destroys an object unexpectedly

2021-09-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 September 2021 at 20:47:41 UTC, H. S. Teoh wrote: Век живи - век учись. А дураком помрёшь. :) "Век живи - век учись, всё равно дураком помрёшь." is correct version. :)

Re: Program crash: GC destroys an object unexpectedly

2021-09-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 September 2021 at 20:47:41 UTC, H. S. Teoh wrote: And since stopper isn't used anymore after declaration, an optimizing compiler is free to assume that it's not needed afterwards, so it's not obligated to keep the reference alive until the end of the function. It was not

Re: Program crash: GC destroys an object unexpectedly

2021-09-21 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Sep 21, 2021 at 08:36:49PM +, eugene via Digitalmars-d-learn wrote: > On Tuesday, 21 September 2021 at 20:17:15 UTC, eugene wrote: > > > Now, change operation order in the main like this: > > Actually, all proposed 'fixes' > > - use stopper somehow in the end

Re: Program crash: GC destroys an object unexpectedly

2021-09-21 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Sep 21, 2021 at 08:17:15PM +, eugene via Digitalmars-d-learn wrote: [...] > ```d > void main(string[] args) { > > auto Main = new Main(); > Main.run(); > > auto stopper = new Stopper(); > stopper.run(); > ``` [...] > ```d > void main(string[] args) { > > auto

Re: Program crash: GC destroys an object unexpectedly

2021-09-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 September 2021 at 20:17:15 UTC, eugene wrote: Now, change operation order in the main like this: Actually, all proposed 'fixes' - use stopper somehow in the end (writeln(stopper.sg0.number)) - change operation order - etc are strange. I mean it's strange (for me) that these

Re: Program crash: GC destroys an object unexpectedly

2021-09-21 Thread jfondren via Digitalmars-d-learn
On Tuesday, 21 September 2021 at 20:17:15 UTC, eugene wrote: Now, change operation order in the main like this: ```d void main(string[] args) { auto Main = new Main(); auto stopper = new Stopper(); Main.run(); stopper.run(); ``` ``` d-lang/edsm-in-d-simple-example-2 $ ./test

Re: Program crash: GC destroys an object unexpectedly

2021-09-21 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Sep 21, 2021 at 07:42:48PM +, jfondren via Digitalmars-d-learn wrote: > On Monday, 13 September 2021 at 17:18:30 UTC, eugene wrote: > > I do not understand at all why GC considers those sg0 and sg1 as > > unreferenced. > > And why old gdc (without -Os) and old ldc do not. > >

Re: Program crash: GC destroys an object unexpectedly

2021-09-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 September 2021 at 19:42:48 UTC, jfondren wrote: On Monday, 13 September 2021 at 17:18:30 UTC, eugene wrote: There's nothing special about sg0 and sg1, except that they're part of Stopper. The Stopper in main() is collected before the end of main() because it's not used later in

Re: Program crash: GC destroys an object unexpectedly

2021-09-21 Thread jfondren via Digitalmars-d-learn
On Monday, 13 September 2021 at 17:18:30 UTC, eugene wrote: I do not understand at all why GC considers those sg0 and sg1 as unreferenced. And why old gdc (without -Os) and old ldc do not. Conclusion: There's nothing special about sg0 and sg1, except that they're part of Stopper. The

Re: MobI? Really?

2021-09-21 Thread jfondren via Digitalmars-d-learn
On Tuesday, 21 September 2021 at 16:14:52 UTC, Chris_D wrote: jfondren: Sorry, but I am talking about documentation. For me, online web pages don't qualify; they are in the cloud, unreal, with no substance. Does anyone really read 300 pages online, in a web browser? Of course not. You can

Re: MobI? Really?

2021-09-21 Thread Chris_D via Digitalmars-d-learn
Thanks for the replies. jfondren: Sorry, but I am talking about documentation. For me, online web pages don't qualify; they are in the cloud, unreal, with no substance. Does anyone really read 300 pages online, in a web browser? Of course not. Jordi Sayol: PDF! ePub! Now that's what I

Re: Why dtor are not executed when removing a struct from associative arrays?

2021-09-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/21/21 2:06 AM, Tejas wrote: On Monday, 20 September 2021 at 18:13:53 UTC, Steven Schveighoffer wrote: On 9/20/21 10:22 AM, Tejas wrote: In case you still want to delete stuff deterministically despite what Steve said, I suggest you make your `struct` a reference and use

better c fibers

2021-09-21 Thread Abby via Digitalmars-d-learn
Hi there, I'm new in dlang I specially like betterC. I was hoping that d fibers would be implemented in without using classes, but there are not. Is there another way how to use async/await in dlang better c? Thank you for your help Abby

Re: Why dtor are not executed when removing a struct from associative arrays?

2021-09-21 Thread Tejas via Digitalmars-d-learn
On Monday, 20 September 2021 at 18:13:53 UTC, Steven Schveighoffer wrote: On 9/20/21 10:22 AM, Tejas wrote: In case you still want to delete stuff deterministically despite what Steve said, I suggest you make your `struct` a reference and use `core.memory.__delete`(not recommended to use this