Re: variable _param_0 cannot be read at compile time

2018-08-09 Thread learnfirst1 via Digitalmars-d-learn
On Thursday, 9 August 2018 at 13:42:03 UTC, Kagamin wrote: struct M { int i; S*[100] s; } struct S { M* mp; bool x; } S* add(A...)() { alias m = A[0]; __gshared s = S(,A[1..$]); m.s[m.i++] = return } void main(){

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)

vibe.d: Finding out if currently in webinterface request

2018-08-09 Thread Johannes Loher via Digitalmars-d-learn
I already posted this in the vibe.d forums (https://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/58891/), but it seems, there is not a lot of activity over there, so I am cross posting this here: Is there a way to find out, if we are currently in a webinterface request? My

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: variable _param_0 cannot be read at compile time

2018-08-09 Thread Kagamin via Digitalmars-d-learn
struct M { int i; S*[100] s; } struct S { M* mp; bool x; } S* add(A...)() { alias m = A[0]; __gshared s = S(,A[1..$]); m.s[m.i++] = return } void main(){ __gshared M m = M(0); __gshared S s = S(, false);

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"); }