Re: Should be easy

2009-06-16 Thread Saaa
template BaseType(T: T[]) { alias BaseType!(T) BaseType; } template BaseType(T) { alias T BaseType; } > Otherwise, you need indexAssign: > > void indexAssign(TArray : TArray[])(TArray array, BaseType!(TArray) value, > int[] indices...) > { > static if (is (typeof (array[0]) == typeof(value)) > {

More 'pure' experiments

2009-06-16 Thread bearophile
I am doing some more experiments with pure functions in D2, I have seen this compiles, but fails at runtime in some non fully clear way (DMD 2.030): import std.stdio: writeln; import std.c.stdlib: malloc; pure foo(int n) { int* p = cast(int*)malloc(int.sizeof * n); if (p == null)

SO: What debugger can be used with D 2.0 on windows and how do I use it?

2009-06-16 Thread BCS
looks like Andrei is getting us some new users: http://stackoverflow.com/questions/1003948/what-debugger-can-be-used-with-d-2-0-on-windows-and-how-do-i-use-it

is this right??

2009-06-16 Thread BCS
void main() { int s; mixin("s") = 5; } - Line 4: found '=' when expecting ';' http://www.digitalmars.com/d/1.0/expression.html#MixinExpression

Re: is this right??

2009-06-16 Thread BCS
Hello BCS, void main() { int s; mixin("s") = 5; } - Line 4: found '=' when expecting ';' http://www.digitalmars.com/d/1.0/expression.html#MixinExpression (mixin("s")) = 5; Given that the above works, it looks like the parser prematurely commits to a mixin declaration when it finds "mixi

Re: is this right??

2009-06-16 Thread Ary Borenszweig
BCS escribió: Hello BCS, void main() { int s; mixin("s") = 5; } - Line 4: found '=' when expecting ';' http://www.digitalmars.com/d/1.0/expression.html#MixinExpression (mixin("s")) = 5; Given that the above works, it looks like the parser prematurely commits to a mixin declaration when

Three questions on std.range

2009-06-16 Thread Sam Hu
Hello, Just get to my point to save time: 1.retro: void testRetro() { int[] arr=[1,2,3,4,5]; auto retArr=retro(arr); for(int i=0;i

Re: is this right??

2009-06-16 Thread BCS
Hello Ary, BCS escribió: Hello BCS, void main() { int s; mixin("s") = 5; } - Line 4: found '=' when expecting ';' http://www.digitalmars.com/d/1.0/expression.html#MixinExpression (mixin("s")) = 5; Given that the above works, it looks like the parser prematurely commits to a mixin decla

Re: is this right??

2009-06-16 Thread hasen
BCS wrote: void main() { int s; mixin("s") = 5; } - Line 4: found '=' when expecting ';' http://www.digitalmars.com/d/1.0/expression.html#MixinExpression mixin *expression* (4+3) = 5;

Re: is this right??

2009-06-16 Thread hasen
hasen wrote: BCS wrote: void main() { int s; mixin("s") = 5; } - Line 4: found '=' when expecting ';' http://www.digitalmars.com/d/1.0/expression.html#MixinExpression mixin *expression* (4+3) = 5; Oh, never mind, AssignExpression can be of the form: ConditionalExpression = Assi

Re: is this right??

2009-06-16 Thread BCS
Hello hasen, hasen wrote: BCS wrote: void main() { int s; mixin("s") = 5; } - Line 4: found '=' when expecting ';' http://www.digitalmars.com/d/1.0/expression.html#MixinExpression mixin *expression* (4+3) = 5; Oh, never mind, AssignExpression can be of the form: ConditionalExpress