Re: Fake global associative array literals

2011-10-28 Thread bearophile
Nick Sabalausky: > So as nice as it would be to use AA initializers at the module-level, this > carries a hidden danger which could be a royal PITA to debug (especially for > D newbies), so I don't think it's a good thing to do. I see. Thank you for your answer. Bye, bearophile

Re: Fake global associative array literals

2011-10-28 Thread Nick Sabalausky
"bearophile" wrote in message news:j8eflp$q3o$1...@digitalmars.com... > What do you think about a rewrite rule that changes code like: > > int[int] aa = [1:2, 3:4]; > void main() {} > > > Into: > > int[int] aa; > static this() { >aa = [1:2, 3:4]; > } > void main() {} > You generally need to

Re: template expressions in C++ to an equivalent in D

2011-10-28 Thread deadalnix
Le 28/10/2011 19:18, Dominic Jones a écrit : Hello, I want to compute, for example d = a + b + c where a..d are of some derived type, without incurring the cost of temporaries for each overloaded operation. In a similar post a while ago, Walter Bright proposed using function literals instead

template expressions in C++ to an equivalent in D

2011-10-28 Thread Dominic Jones
Hello, I want to compute, for example d = a + b + c where a..d are of some derived type, without incurring the cost of temporaries for each overloaded operation. In a similar post a while ago, Walter Bright proposed using function literals instead of template expressions to do this. After looki

Re: FIFO stack

2011-10-28 Thread Jonathan M Davis
On Friday, October 28, 2011 13:24:58 Dominic Jones wrote: > To conclude the matter regarding the absence of a FIFO stack in the > standard library and the not so good alternative of arrays (in > particular where there are a significant number of push-pops and the > maximum length is not initially k

Fake global associative array literals

2011-10-28 Thread bearophile
What do you think about a rewrite rule that changes code like: int[int] aa = [1:2, 3:4]; void main() {} Into: int[int] aa; static this() { aa = [1:2, 3:4]; } void main() {} Bye, bearophile

Re: FIFO stack

2011-10-28 Thread Dominic Jones
To conclude the matter regarding the absence of a FIFO stack in the standard library and the not so good alternative of arrays (in particular where there are a significant number of push-pops and the maximum length is not initially known): Does anyone in-the-know know if something like "DList" (a