Re: D / GtkD for SQL Server

2013-10-21 Thread John Joyus
On 10/21/2013 07:27 PM, Adam D. Ruppe wrote: On Monday, 21 October 2013 at 22:23:16 UTC, John Joyus wrote: 1. When I click the OK button, the message dialog pops-up *after* the main window is closed, though the window.close(); line is after the call to the MessageBox.. that's because the Messa

Re: D and C++

2013-10-21 Thread qznc
On Monday, 21 October 2013 at 11:29:54 UTC, develop32 wrote: On Monday, 21 October 2013 at 11:08:15 UTC, qznc wrote: On Saturday, 19 October 2013 at 13:20:28 UTC, develop32 wrote: Hi, Are there any recent improvements in how D interfaces with C++? I got the impression that some work has been d

Re: Changing elements during foreach

2013-10-21 Thread qznc
On Monday, 21 October 2013 at 20:14:09 UTC, ixid wrote: On Monday, 21 October 2013 at 19:37:47 UTC, Jonathan M Davis wrote: On Monday, October 21, 2013 21:16:00 qznc wrote: On Monday, 21 October 2013 at 16:22:29 UTC, Krzysztof Ciebiera wrote: > I understand slices now and I don't find it consi

Re: D on Windows - linker question

2013-10-21 Thread evilrat
On Tuesday, 22 October 2013 at 01:07:48 UTC, Erik van Velzen wrote: I do get a few compiler errors with DMD in these win32.* modules about incorrect typecasts. I will make a new topic if these persist or file a bug report with the author. if you use x64 build then i must disappoint you, it only

Re: D on Windows - linker question

2013-10-21 Thread Erik van Velzen
On Monday, 21 October 2013 at 04:38:05 UTC, evilrat wrote: i'm currently trying to get up DirectX(d3d10(x),d3d11(x),xaudio2,x3daudio,d3dmath) up and running in free time, but i constantly encounter serious problems on my way. now i have some weird problems with COM(no COM - no DirectX). so

Re: D / GtkD for SQL Server

2013-10-21 Thread Adam D. Ruppe
On Monday, 21 October 2013 at 22:23:16 UTC, John Joyus wrote: 1. When I click the OK button, the message dialog pops-up *after* the main window is closed, though the window.close(); line is after the call to the MessageBox.. that's because the MessageBox class here is implemented as another w

Re: Changing elements during foreach

2013-10-21 Thread Jonathan M Davis
On Monday, October 21, 2013 22:14:08 ixid wrote: > What would be the issue/s with disallowing appending to slices? > So you'd have to explicitly duplicate before you could append. All arrays are slices. There is no difference between the two. It's just that if you start appending to one, it will

Re: D / GtkD for SQL Server

2013-10-21 Thread John Joyus
On 10/21/2013 03:29 PM, Adam D. Ruppe wrote: oops, it was not supposed to have a scroll bar at all. Fixed, it was a one line change, line 1823, remove the HSCROLL members. New version is on github too. That works! I've had some trouble with WinXP and background colors on checkboxes and radio

Re: Cannot alias expression

2013-10-21 Thread Dicebot
On Monday, 21 October 2013 at 20:20:45 UTC, John Colvin wrote: Why on earth not? By spec / definition. Alias is intended to only work on symbols (that is the very definition of alias). Unfortunately, template alias parameter has also extra special cases for now good reason which adds confusi

Re: Cannot alias expression

2013-10-21 Thread John Colvin
On Monday, 21 October 2013 at 19:14:25 UTC, simendsjo wrote: On Monday, 21 October 2013 at 18:42:27 UTC, John Colvin wrote: On Monday, 21 October 2013 at 12:58:55 UTC, John Colvin wrote: I suspect I'm being very dumb here, but I can't get my head around this: template B(alias A) {

Re: Changing elements during foreach

2013-10-21 Thread ixid
On Monday, 21 October 2013 at 19:37:47 UTC, Jonathan M Davis wrote: On Monday, October 21, 2013 21:16:00 qznc wrote: On Monday, 21 October 2013 at 16:22:29 UTC, Krzysztof Ciebiera wrote: > I understand slices now and I don't find it consistent with > "no > shoot in the foot by default" statem

Re: Cannot alias expression

2013-10-21 Thread Dicebot
On Monday, 21 October 2013 at 19:33:07 UTC, simendsjo wrote: I've used quite some T(A...), so I was used to literals not being aliasable. A bit strange that literals "is symbols" (or how I should phrase it) when using T(alias A), but not T(A...). Literals are never symbols. It is a special cas

Re: Changing elements during foreach

2013-10-21 Thread Jonathan M Davis
On Monday, October 21, 2013 21:16:00 qznc wrote: > On Monday, 21 October 2013 at 16:22:29 UTC, Krzysztof Ciebiera > > wrote: > > I understand slices now and I don't find it consistent with "no > > shoot in the foot by default" statement. > > I agree. The pitfalls are well understood, yet everybod

Re: Cannot alias expression

2013-10-21 Thread simendsjo
On Monday, 21 October 2013 at 16:51:02 UTC, simendsjo wrote: On Monday, 21 October 2013 at 15:00:26 UTC, Dicebot wrote: On Monday, 21 October 2013 at 12:58:55 UTC, John Colvin wrote: I suspect I'm being very dumb here, but I can't get my head around this: template B(alias A) { ali

Re: Cannot alias expression

2013-10-21 Thread simendsjo
On Monday, 21 October 2013 at 16:51:02 UTC, simendsjo wrote: On Monday, 21 October 2013 at 15:00:26 UTC, Dicebot wrote: On Monday, 21 October 2013 at 12:58:55 UTC, John Colvin wrote: I suspect I'm being very dumb here, but I can't get my head around this: template B(alias A) { ali

Re: Changing elements during foreach

2013-10-21 Thread Dicebot
On Monday, 21 October 2013 at 16:22:29 UTC, Krzysztof Ciebiera wrote: What I want to do is: I want to take a look at every single solution and extend it if it is possible (eg. if solution contains obbects a,b,c it can also contain d). void main() { import std.stdio; int[][] dat

Re: D / GtkD for SQL Server

2013-10-21 Thread Adam D. Ruppe
On Monday, 21 October 2013 at 19:01:11 UTC, John Joyus wrote: When I run the executable, the edit control shows no usable height. It reduced to 0.5 mm, and width goes beyond the window, leaving a scroll bar. oops, it was not supposed to have a scroll bar at all. Fixed, it was a one line chang

Re: Cannot alias expression

2013-10-21 Thread Dicebot
Please check the specification I have linked ;) It is a weird design but implementation currently conforms to it.

Re: Changing elements during foreach

2013-10-21 Thread qznc
On Monday, 21 October 2013 at 16:22:29 UTC, Krzysztof Ciebiera wrote: I understand slices now and I don't find it consistent with "no shoot in the foot by default" statement. I agree. The pitfalls are well understood, yet everybody seems to love them. Ok, compared to C array they are an improv

Re: Cannot alias expression

2013-10-21 Thread simendsjo
On Monday, 21 October 2013 at 18:42:27 UTC, John Colvin wrote: On Monday, 21 October 2013 at 12:58:55 UTC, John Colvin wrote: I suspect I'm being very dumb here, but I can't get my head around this: template B(alias A) { alias B = A; } template C(A ...) { alias C

Re: D / GtkD for SQL Server

2013-10-21 Thread John Joyus
The full example now compiles with those two new files, thanks. When I run the executable, the edit control shows no usable height. It reduced to 0.5 mm, and width goes beyond the window, leaving a scroll bar. Trying to set its Height and Width in the example program had no effect. Btw, I hav

Re: Cannot alias expression

2013-10-21 Thread John Colvin
On Monday, 21 October 2013 at 12:58:55 UTC, John Colvin wrote: I suspect I'm being very dumb here, but I can't get my head around this: template B(alias A) { alias B = A; } template C(A ...) { alias C = A[0]; } static assert(B!1 == 1); //fine stat

Re: Cannot alias expression

2013-10-21 Thread Jesse Phillips
On Monday, 21 October 2013 at 12:58:55 UTC, John Colvin wrote: I suspect I'm being very dumb here, but I can't get my head around this: template B(alias A) { alias B = A; } template C(A ...) { alias C = A[0]; } static assert(B!1 == 1); //fine stat

Re: Cannot alias expression

2013-10-21 Thread Dicebot
On Monday, 21 October 2013 at 16:51:02 UTC, simendsjo wrote: I didn't know the B template would work... Is this correct semantics according to the spec? http://dlang.org/template.html#TemplateAliasParameter "Literals can also be used as arguments to alias parameters."

Re: Cannot alias expression

2013-10-21 Thread simendsjo
On Monday, 21 October 2013 at 15:00:26 UTC, Dicebot wrote: On Monday, 21 October 2013 at 12:58:55 UTC, John Colvin wrote: I suspect I'm being very dumb here, but I can't get my head around this: template B(alias A) { alias B = A; } template C(A ...) { alias C = A

Re: Changing elements during foreach

2013-10-21 Thread Krzysztof Ciebiera
On Monday, 21 October 2013 at 14:59:54 UTC, Alexandr Druzhinin wrote: If you switch instruction order you create local copy and then set x[0] in local copy so original is unchanged. But local copy creating depends on several thing and happens not every appending in general. Your way is not D-is

Re: D / GtkD for SQL Server

2013-10-21 Thread Adam D. Ruppe
On Monday, 21 October 2013 at 05:14:50 UTC, John Joyus wrote: Btw, I had to comment out the lines that contain TextLabel and the .content in the example code as it fails to compile with following errors: I just added that class yesterday and probably forgot to push to github grab new versio

Re: Cannot alias expression

2013-10-21 Thread Dicebot
On Monday, 21 October 2013 at 12:58:55 UTC, John Colvin wrote: I suspect I'm being very dumb here, but I can't get my head around this: template B(alias A) { alias B = A; } template C(A ...) { alias C = A[0]; } static assert(B!1 == 1); //fine stat

Re: Changing elements during foreach

2013-10-21 Thread Alexandr Druzhinin
21.10.2013 17:55, Krzysztof Ciebiera пишет: On Monday, 21 October 2013 at 10:41:38 UTC, Alexandr Druzhinin wrote: 21.10.2013 17:31, Krzysztof Ciebiera пишет: void main() { int a[][] = [[1,2,3]]; foreach(x; a) { x[0] = 0; x ~= 4; } writeln(a); } ... &) or [0,2

Re: Call destructor directly.

2013-10-21 Thread Agustin
On Monday, 21 October 2013 at 07:31:30 UTC, Ali Çehreli wrote: On 10/20/2013 10:59 PM, Agustin wrote: > That didn't work, but after reading how emplace works, i had to make > some changes. > > public T allocate(T : Object, A...)(auto ref A arguments) { > auto pMemory = rawAllocate(

Cannot alias expression

2013-10-21 Thread John Colvin
I suspect I'm being very dumb here, but I can't get my head around this: template B(alias A) { alias B = A; } template C(A ...) { alias C = A[0]; } static assert(B!1 == 1); //fine static assert(C!1 == 1); //Error: cannot alias an expression 1

Re: Call destructor directly.

2013-10-21 Thread Dicebot
On Monday, 21 October 2013 at 11:48:11 UTC, Benjamin Thaut wrote: Using destroy will zero the entire memory block after destroying the object. If you are freeing the memory right after destroying this is going to cost you performance. To avoid this declare: extern (C) void rt_finalize2(void*

Re: Call destructor directly.

2013-10-21 Thread Benjamin Thaut
Am 21.10.2013 04:17, schrieb Adam D. Ruppe: On Monday, 21 October 2013 at 02:06:02 UTC, Agustin wrote: I'm implementing some custom memory allocator, is possible to call an object destructor directly? destroy(object); destroy is in the automatically imported object.dm so you don't have to im

Re: Weird error when compiling.

2013-10-21 Thread bearophile
Agustin: The code is: http://pastebin.com/510YK2Se Using (LDC 0.12.0-beta 1 Ubuntu): http://pastebin.com/2gAWnYyr Using (DMD Windows): Assertion failure: 'thisval && thisval->op == TOKclassreference' on line 4067 in file 'interpret.c' when compiling this. Thank you. I presume this bug is alr

Re: Changing elements during foreach

2013-10-21 Thread bearophile
Krzysztof Ciebiera: Is the following compiler behavior consistent with language specification? Changing elements during foreach is something to avoid, perhaps I'd like it to be statically forbidden. If you add to this the reference-struct nature of arrays, you get in troubles. Bye, bearoph

Re: D and C++

2013-10-21 Thread develop32
On Monday, 21 October 2013 at 11:08:15 UTC, qznc wrote: On Saturday, 19 October 2013 at 13:20:28 UTC, develop32 wrote: Hi, Are there any recent improvements in how D interfaces with C++? I got the impression that some work has been done on that, in order to make DMD a self-hosting compiler.

Re: D and C++

2013-10-21 Thread qznc
On Saturday, 19 October 2013 at 13:20:28 UTC, develop32 wrote: Hi, Are there any recent improvements in how D interfaces with C++? I got the impression that some work has been done on that, in order to make DMD a self-hosting compiler. I do not know of any recent improvements. The current pl

Re: Changing elements during foreach

2013-10-21 Thread qznc
On Monday, 21 October 2013 at 10:31:51 UTC, Krzysztof Ciebiera wrote: Is the following compiler behavior consistent with language specification? import std.stdio; void main() { int a[][] = [[1,2,3]]; foreach(x; a) { x[0] = 0; x ~= 4; } writeln(a); } I under

Re: Changing elements during foreach

2013-10-21 Thread Krzysztof Ciebiera
On Monday, 21 October 2013 at 10:41:38 UTC, Alexandr Druzhinin wrote: 21.10.2013 17:31, Krzysztof Ciebiera пишет: void main() { int a[][] = [[1,2,3]]; foreach(x; a) { x[0] = 0; x ~= 4; } writeln(a); } ... &) or [0,2,3,4] (python, C++ ref). But [0,2,3]? It was

Re: Changing elements during foreach

2013-10-21 Thread Alexandr Druzhinin
21.10.2013 17:31, Krzysztof Ciebiera пишет: Is the following compiler behavior consistent with language specification? import std.stdio; void main() { int a[][] = [[1,2,3]]; foreach(x; a) { x[0] = 0; x ~= 4; } writeln(a); } I understand why thw progra

Changing elements during foreach

2013-10-21 Thread Krzysztof Ciebiera
Is the following compiler behavior consistent with language specification? import std.stdio; void main() { int a[][] = [[1,2,3]]; foreach(x; a) { x[0] = 0; x ~= 4; } writeln(a); } I understand why thw program could output [1,2,3] (like in C++ without &) or

Re: D on Windows - linker question

2013-10-21 Thread evilrat
On Monday, 21 October 2013 at 08:12:49 UTC, Andrew wrote: If you want to offer Direct3D in D as is (I prefer this option instead of wrapper-libraries), you'll have to make it COM'ish and C'ish :-) I actually consider looking into this problem, I'm skilled C++ graphics programmer. i think ab

Re: D on Windows - linker question

2013-10-21 Thread Andrew
On Monday, 21 October 2013 at 07:56:49 UTC, evilrat wrote: On Monday, 21 October 2013 at 07:46:41 UTC, Andrew wrote: On Monday, 21 October 2013 at 04:38:05 UTC, evilrat wrote: On Sunday, 20 October 2013 at 21:47:53 UTC, Erik van Velzen wrote: My goal was to learn D and Direct3D at the same tim

Re: D on Windows - linker question

2013-10-21 Thread evilrat
On Monday, 21 October 2013 at 07:46:41 UTC, Andrew wrote: On Monday, 21 October 2013 at 04:38:05 UTC, evilrat wrote: On Sunday, 20 October 2013 at 21:47:53 UTC, Erik van Velzen wrote: My goal was to learn D and Direct3D at the same time. I've tried to set up DMD to do this, but I keep running

Re: D on Windows - linker question

2013-10-21 Thread Andrew
On Monday, 21 October 2013 at 04:38:05 UTC, evilrat wrote: On Sunday, 20 October 2013 at 21:47:53 UTC, Erik van Velzen wrote: My goal was to learn D and Direct3D at the same time. I've tried to set up DMD to do this, but I keep running into issues that the available DirectX11 and win32 headers

Re: Call destructor directly.

2013-10-21 Thread Ali Çehreli
On 10/20/2013 10:59 PM, Agustin wrote: > That didn't work, but after reading how emplace works, i had to make > some changes. > > public T allocate(T : Object, A...)(auto ref A arguments) { > auto pMemory = rawAllocate(__traits(classInstanceSize, T), > T.alignof); Does rawAllocate