Threads & Message Passing - Best practices ?

2017-09-11 Thread Jonas Mminnberg via Digitalmars-d
I am using the recommended message passing threading model for my project, and it is not always clear how to do things in the best way; 1. receive() pattern matching -- what is common here, always send (int, someData) where int is a value you compare to. Or create dummy types that you can

Re: Static inline field initialization

2017-08-22 Thread Jonas Mminnberg via Digitalmars-d
On Tuesday, 22 August 2017 at 12:20:45 UTC, Moritz Maxeiner wrote: I agree that it can be confusing if you try to read it with C++ semantics [1]; the solution, however, imho is not to change D semantics or throw warnings [2], but to refer to the D spec [3], which states that static

Static inline field initialization

2017-08-22 Thread Jonas Mminnberg via Digitalmars-d
Because of D's static initialization of members, this assert fails: class Test { ubyte[] buf = new ubyte[1000]; } void main() { auto a = new Test(); auto b = new Test(); assert(a.buf.ptr != b.buf.ptr); } This is bad, since; * It is not how C++ works * It introduces silent