Re: How do you put log calls in constructors when they may be created in a static context?

2018-08-10 Thread aliak via Digitalmars-d-learn
On Friday, 10 August 2018 at 09:29:04 UTC, Timoses wrote: On Wednesday, 8 August 2018 at 21:54:34 UTC, aliak wrote: I'm trying to debug stuff, so I want to add verbose logging struct S(T) { this() { writeln("created S(T) with properties and ID"); } } static a = S!int(); // bah I

Re: How do you put log calls in constructors when they may be created in a static context?

2018-08-10 Thread Timoses via Digitalmars-d-learn
On Wednesday, 8 August 2018 at 21:54:34 UTC, aliak wrote: I'm trying to debug stuff, so I want to add verbose logging struct S(T) { this() { writeln("created S(T) with properties and ID"); } } static a = S!int(); // bah I guess users can call this code from any context, but when i'd

Re: How do you put log calls in constructors when they may be created in a static context?

2018-08-09 Thread aliak via Digitalmars-d-learn
On Thursday, 9 August 2018 at 20:02:41 UTC, Jonathan M Davis wrote: On Thursday, August 9, 2018 7:15:58 AM MDT aliak via Digitalmars-d-learn wrote: [...] It's failing, because you got the condition backwards. __ctfe is true during CTFE and false during runtime. Your code has if(__ctfe)

Re: How do you put log calls in constructors when they may be created in a static context?

2018-08-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, August 9, 2018 7:15:58 AM MDT aliak via Digitalmars-d-learn wrote: > On Thursday, 9 August 2018 at 12:01:42 UTC, Jonathan M Davis > > wrote: > > On Thursday, August 9, 2018 2:37:49 AM MDT aliak via > > > > Digitalmars-d-learn wrote: > >> On Wednesday, 8 August 2018 at 23:47:22 UTC,

Re: How do you put log calls in constructors when they may be created in a static context?

2018-08-09 Thread aliak via Digitalmars-d-learn
On Thursday, 9 August 2018 at 12:01:42 UTC, Jonathan M Davis wrote: On Thursday, August 9, 2018 2:37:49 AM MDT aliak via Digitalmars-d-learn wrote: On Wednesday, 8 August 2018 at 23:47:22 UTC, Jonathan M Davis wrote: > On Wednesday, August 8, 2018 3:54:34 PM MDT aliak via > >

Re: How do you put log calls in constructors when they may be created in a static context?

2018-08-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, August 9, 2018 2:37:49 AM MDT aliak via Digitalmars-d-learn wrote: > On Wednesday, 8 August 2018 at 23:47:22 UTC, Jonathan M Davis > > wrote: > > On Wednesday, August 8, 2018 3:54:34 PM MDT aliak via > > > > Digitalmars-d-learn wrote: > >> I'm trying to debug stuff, so I want to add

Re: How do you put log calls in constructors when they may be created in a static context?

2018-08-09 Thread aliak via Digitalmars-d-learn
On Wednesday, 8 August 2018 at 23:47:22 UTC, Jonathan M Davis wrote: On Wednesday, August 8, 2018 3:54:34 PM MDT aliak via Digitalmars-d-learn wrote: I'm trying to debug stuff, so I want to add verbose logging struct S(T) { this() { writeln("created S(T) with properties and ID"); }

Re: How do you put log calls in constructors when they may be created in a static context?

2018-08-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, August 8, 2018 3:54:34 PM MDT aliak via Digitalmars-d-learn wrote: > I'm trying to debug stuff, so I want to add verbose logging > > struct S(T) { >this() { > writeln("created S(T) with properties and ID"); >} > } > > static a = S!int(); // bah > > I guess users can