Re: Compile time metaprogramming

2011-12-03 Thread David Nadlinger
On 12/3/11 1:43 AM, simendsjo wrote: On 02.12.2011 23:28, Jonathan M Davis wrote: There's also been at least a couple of cases where people have worked on unit libraries and discussed them in the main newsgroup, but so far, nothing has gotten to the point where it's been reviewed for

Re: Compile time metaprogramming

2011-12-03 Thread Dejan Lekic
David, to be frank, your code is already useful! Something is better than *nothing*! I hope you or someone else will continue with these two modules, and include them in Phobos.

Re: Compile time metaprogramming

2011-12-03 Thread simendsjo
On 03.12.2011 10:26, David Nadlinger wrote: I posted my project to the NG, and there seemed to actually be two or three people interested in it, but I didn't submit it to formal review yet, because it sometimes breaks in interesting ways due to compiler bugs (issue 3467 [3] and the likes), and

Re: Compile time metaprogramming

2011-12-03 Thread David Nadlinger
On 12/3/11 1:49 PM, simendsjo wrote: Seems one of your bugs recently got a pull request: https://github.com/D-Programming-Language/dmd/pull/449 I'm aware of that, though Walter apparently still thinks it's okay for foo!3u and foo!3 to be different things given »template foo(uint u)«… David

Non-atomic ops allowed on shared variables?

2011-12-03 Thread Andrej Mitrovic
I thought this wasn't allowed: shared uint threadsCount; void bumpThreadsCount() { ++threadsCount; } void main() { } According to TDPL it should error and we should use atomicOp from std.concurrency instead. atomicOp is what I've used so far if I had to use shared variables. Has ++

C++ vs D aggregates

2011-12-03 Thread Dejan Lekic
I recently stumbled on this thread: http://stackoverflow.com/ questions/5666321/what-is-assignment-via-curly-braces-called-and-can-it- be-controlled The important part is this: 8 - begin - The Standard says in section §8.5.1/1, An aggregate is an array or a class

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread David Nadlinger
On 12/3/11 8:19 PM, Jonathan M Davis wrote: Sure, if you use anything other than an atomic operation on a shared object and don't use a synchronized block or a mutex or the like, you risk race conditions, but if every operation on a shared object had to actually be atomic, you couldn't do much

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Jonathan M Davis
On Saturday, December 03, 2011 20:22:40 David Nadlinger wrote: On 12/3/11 8:19 PM, Jonathan M Davis wrote: Sure, if you use anything other than an atomic operation on a shared object and don't use a synchronized block or a mutex or the like, you risk race conditions, but if every

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Andrej Mitrovic
On 12/3/11, Jonathan M Davis jmdavisp...@gmx.com wrote: Where in TDPL does it say this? Page 413. Requiring that all operations on a shared object be atomic would be highly restrictive. Yeah sorry, my title was wrong, of course you could use synchronization instead of atomics. But shared

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Jonathan M Davis
On Saturday, December 03, 2011 20:54:38 Andrej Mitrovic wrote: On 12/3/11, Jonathan M Davis jmdavisp...@gmx.com wrote: Where in TDPL does it say this? Page 413. Requiring that all operations on a shared object be atomic would be highly restrictive. Yeah sorry, my title was wrong, of

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Andrej Mitrovic
On 12/3/11, Jonathan M Davis jmdavisp...@gmx.com wrote: That page says that reads and writes are guaranteed to be atomic for shared. It does _not_ say that something like ++threadsCount is guaranteed to be atomic. Woops, sorry it was a typo. I meant page 411, not 413. It says it's an error

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Jonathan M Davis
On Saturday, December 03, 2011 21:41:45 Andrej Mitrovic wrote: On 12/3/11, Jonathan M Davis jmdavisp...@gmx.com wrote: That page says that reads and writes are guaranteed to be atomic for shared. It does _not_ say that something like ++threadsCount is guaranteed to be atomic. Woops,

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Timon Gehr
On 12/03/2011 09:49 PM, Jonathan M Davis wrote: On Saturday, December 03, 2011 21:41:45 Andrej Mitrovic wrote: On 12/3/11, Jonathan M Davisjmdavisp...@gmx.com wrote: That page says that reads and writes are guaranteed to be atomic for shared. It does _not_ say that something like

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Timon Gehr
On 12/03/2011 11:30 PM, Jonathan M Davis wrote: On Saturday, December 03, 2011 22:56:41 Timon Gehr wrote: On 12/03/2011 09:49 PM, Jonathan M Davis wrote: On Saturday, December 03, 2011 21:41:45 Andrej Mitrovic wrote: On 12/3/11, Jonathan M Davisjmdavisp...@gmx.com wrote: That page says

Re: C++ vs D aggregates

2011-12-03 Thread Don
On 03.12.2011 20:14, Dejan Lekic wrote: I recently stumbled on this thread: http://stackoverflow.com/ questions/5666321/what-is-assignment-via-curly-braces-called-and-can-it- be-controlled The important part is this: 8 - begin - The Standard says in section §8.5.1/1,