Re: Finite state machine in D

2012-09-29 Thread Druzhinin Alexandr
28.09.2012 01:24, Philippe Sigaud пишет: Here is an example: http://dpaste.dzfl.pl/81a63163 it's really interesting for me. Seeing your code in another thread, yes code generation could help here. I have a template tutorial (a bit light on code generation) that might help you on this.

Re: Using Cairo library bindings on Windows

2012-09-29 Thread KillerSponge
On Friday, 28 September 2012 at 22:20:54 UTC, Andrej Mitrovic wrote: On 9/28/12, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: I have some win32 cairo samples on my github page. Here you go: https://github.com/AndrejMitrovic/cairoDSamples Just follow the readme instructions. Wow, thank

Re: compiler assertion

2012-09-29 Thread Zhenya
On Saturday, 29 September 2012 at 13:03:31 UTC, Philippe Sigaud wrote: On Fri, Sep 28, 2012 at 10:32 PM, Zhenya zh...@list.ru wrote: Thank you,understood. This should work, hopefully: import std.stdio; import std.typetuple; template sum(U...) { static if(U.length == 0)

Re: Using Cairo library bindings on Windows

2012-09-29 Thread Andrej Mitrovic
On 9/29/12, KillerSponge killerspo...@gmail.com wrote: Wow, thank you so much for the quick reply and all the effort! I am going to try this out as soon as I can (which probably won't be until Monday, sorry..) and let you know how it works out :) No problem. I also have some samples written

Struct assignment, possible DMD bug?

2012-09-29 Thread ixid
This behaviour seems inconsistent and unintuitive: void main() { int[3] a = [1,2,3]; a = [4, a[0], 6]; struct S { int a, b, c; } S s = S(1,2,3); s = S(4, s.a, 6); assert(a == [4,1,6]); assert(s == S(4,4,6)); }

Re: Struct assignment, possible DMD bug?

2012-09-29 Thread Maxim Fomin
On Saturday, 29 September 2012 at 16:05:03 UTC, ixid wrote: This behaviour seems inconsistent and unintuitive: void main() { int[3] a = [1,2,3]; a = [4, a[0], 6]; struct S { int a, b, c; } S s = S(1,2,3); s = S(4, s.a, 6);

Re: Struct assignment, possible DMD bug?

2012-09-29 Thread Timon Gehr
On 09/29/2012 06:26 PM, Maxim Fomin wrote: On Saturday, 29 September 2012 at 16:05:03 UTC, ixid wrote: This behaviour seems inconsistent and unintuitive: void main() { int[3] a = [1,2,3]; a = [4, a[0], 6]; struct S { int a, b, c; } S s = S(1,2,3); s = S(4,

Re: Struct assignment, possible DMD bug?

2012-09-29 Thread Tommi
On Saturday, 29 September 2012 at 18:16:24 UTC, Timon Gehr wrote: This seems to be a DMD bug. And a pretty serious looking one at that. That bug could make nukes fly to wrong coordinates, and that just ruins everybody's day.

Re: Struct assignment, possible DMD bug?

2012-09-29 Thread Ali Çehreli
On 09/29/2012 11:16 AM, Timon Gehr wrote: On 09/29/2012 06:26 PM, Maxim Fomin wrote: S s = S(1,2,3); s = S(4, s.a, 6); assert(a == [4,1,6]); assert(s == S(4,4,6)); } Setting the struct writes s.a before evaluating it while the reverse is true of the array assignment. Using DMD 2.0.60.

Re: Struct assignment, possible DMD bug?

2012-09-29 Thread Ali Çehreli
On 09/29/2012 04:02 PM, Timon Gehr wrote: On 09/30/2012 12:51 AM, Ali Çehreli wrote: On 09/29/2012 11:16 AM, Timon Gehr wrote: On 09/29/2012 06:26 PM, Maxim Fomin wrote: S s = S(1,2,3); s = S(4, s.a, 6); assert(a == [4,1,6]); assert(s == S(4,4,6)); } Setting the struct writes

Very strange problem with comparing floating point numbers

2012-09-29 Thread Ivan Agafonov
// Tell me about this sutation, may be it is a bug? import std.math; import std.stdio; struct Vector(int size) { union { float[size] array = 0; struct { static if (size == 2) float x, y;

Re: Struct assignment, possible DMD bug?

2012-09-29 Thread ixid
On Sunday, 30 September 2012 at 00:24:34 UTC, Ali Çehreli wrote: On 09/29/2012 04:02 PM, Timon Gehr wrote: On 09/30/2012 12:51 AM, Ali Çehreli wrote: On 09/29/2012 11:16 AM, Timon Gehr wrote: On 09/29/2012 06:26 PM, Maxim Fomin wrote: S s = S(1,2,3); s = S(4, s.a, 6); assert(a ==

Re: Struct assignment, possible DMD bug?

2012-09-29 Thread Ali Çehreli
On 09/29/2012 08:13 PM, ixid wrote: On Sunday, 30 September 2012 at 00:24:34 UTC, Ali Çehreli wrote: On 09/29/2012 04:02 PM, Timon Gehr wrote: On 09/30/2012 12:51 AM, Ali Çehreli wrote: On 09/29/2012 11:16 AM, Timon Gehr wrote: On 09/29/2012 06:26 PM, Maxim Fomin wrote: S s =