Re: define new types within templates

2009-12-30 Thread Phil Deets
On Tue, 29 Dec 2009 17:44:18 -0500, teo wrote: There was a way to define new types within templates and I think that I have seen that demonstrated here in the newsgroups, but cannot find it now. Can someone help me please? I would like to do something like this: template MyTemplate(T) { s

Re: Is there a reason for default-int?

2009-12-30 Thread Phil Deets
I think it would be best for D to do the same. Just my 2ยข, Phil Deets

Re: Runtime error when accessing static data in a DLL

2009-12-24 Thread Phil Deets
On Thu, 24 Dec 2009 13:10:14 -0500, Phil Deets wrote: On Thu, 24 Dec 2009 12:49:42 -0500, Richard Webb wrote: Sounds like you might be running into this: http://d.puremagic.com/issues/show_bug.cgi?id=3342 Thanks for the link. That is probably my problem since I'm running Windo

Re: Runtime error when accessing static data in a DLL

2009-12-24 Thread Phil Deets
On Thu, 24 Dec 2009 10:49:01 -0500, Phil Deets wrote: I'll work on reproducing it in a smaller scale Reduced test case: test.c (compiled with Visual C++ 2008 Express Edition) // Adapted from sample code at http://msdn.microsoft.com/en-us/library/ms680582(VS.85).aspx #include #in

Re: Runtime error when accessing static data in a DLL

2009-12-24 Thread Phil Deets
On Thu, 24 Dec 2009 12:49:42 -0500, Richard Webb wrote: Sounds like you might be running into this: http://d.puremagic.com/issues/show_bug.cgi?id=3342 Thanks for the link. That is probably my problem since I'm running Windows XP. Phil

Runtime error when accessing static data in a DLL

2009-12-24 Thread Phil Deets
I'm writing a DLL in D which will be loaded (not automatically, but by LoadLibrary) by a C application (the Lua interpreter). I'm having problems with globals and static data. Everything is fine if I only access stuff on the stack, but as soon as I access a global or a static class variable,

Re: Making a DLL with a static library dependency

2009-12-17 Thread Phil Deets
On Thu, 17 Dec 2009 08:32:41 -0500, Phil Deets wrote: On Tue, 15 Dec 2009 00:56:12 -0500, Phil Deets wrote: (D 2.033) I'm porting a DLL to D. The DLL depends on a static library, but when I put the library name on the command-line, dmd does not output any DLL file. If I remov

Re: Making a DLL with a static library dependency

2009-12-17 Thread Phil Deets
On Tue, 15 Dec 2009 00:56:12 -0500, Phil Deets wrote: (D 2.033) I'm porting a DLL to D. The DLL depends on a static library, but when I put the library name on the command-line, dmd does not output any DLL file. If I remove the library name from the command-line, dmd gives linker e

Re: Making a DLL with a static library dependency

2009-12-15 Thread Phil Deets
On Tue, 15 Dec 2009 07:06:49 -0500, Trass3r wrote: Phil Deets schrieb: Actually, it depends on another DLL. The static library I need to link to is an import library for that DLL. I'll work on loading that DLL without the .lib file using the Windows API while I wait for an answer

Re: Making a DLL with a static library dependency

2009-12-14 Thread Phil Deets
On Tue, 15 Dec 2009 00:56:12 -0500, Phil Deets wrote: (D 2.033) I'm porting a DLL to D. The DLL depends on a static library, but when I put the library name on the command-line, dmd does not output any DLL file. If I remove the library name from the command-line, dmd gives linker e

Making a DLL with a static library dependency

2009-12-14 Thread Phil Deets
(D 2.033) I'm porting a DLL to D. The DLL depends on a static library, but when I put the library name on the command-line, dmd does not output any DLL file. If I remove the library name from the command-line, dmd gives linker errors and outputs an invalid DLL. How do I make a DLL with a st

Re: Implicit conversion from array of class to array of interface

2009-12-13 Thread Phil Deets
On Sun, 13 Dec 2009 04:08:19 -0500, Phil Deets wrote: I found another workaround which doesn't require a bunch of extra overloads. I'll probably update it to use that template someone wrote in that thread about static duck-typing. I looked up this post. It was: "Re: stati

Re: Implicit conversion from array of class to array of interface

2009-12-13 Thread Phil Deets
On Sun, 13 Dec 2009 04:16:19 -0500, Frank Benoit wrote: casting an array of class references to an array of interface references (or vice versa) will not work at runtime. Your program will crash. This is because if the invisible pointer correction that is done if you cast a single class ref

Re: Implicit conversion from array of class to array of interface

2009-12-13 Thread Phil Deets
On Sun, 13 Dec 2009 03:22:31 -0500, Phil Deets wrote: (D 2.033) I have a need to do something like this code: interface I {} class C : I {} class D : I {} void f(I[]) {} void f(bool) {} void g(T)(T param) { f(param); } int main() { bool b; C[] c; D[] d

Implicit conversion from array of class to array of interface

2009-12-13 Thread Phil Deets
f(param); } int main() { bool b; C[] c; D[] d; g(b); g(c); g(d); return 0; } Is there a better way to deal with this? Is this behavior a design bug? Phil Deets -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Re: Getting the text of an exception

2009-12-12 Thread Phil Deets
On Fri, 11 Dec 2009 08:32:21 -0500, Michal Minich wrote: Hello Phil, How can I get the unadorned text of an exception? e.msg Thanks, is this documented somewhere? -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Getting the text of an exception

2009-12-11 Thread Phil Deets
How can I get the unadorned text of an exception? When I run: import std.stdio; int main() { try { throw new Exception("text"); } catch (Exception e) { writeln(e.toString()); } return 0; } I get the output: object.Exceptio

Re: Question about mutable arrays

2009-11-19 Thread Phil Deets
On Thu, 19 Nov 2009 09:16:16 -0500, A Bothe wrote: Hey guys, I've found a problem that occurred since DMD 2.034: When I've created a dynamic array like string[] a; and I want to assign something via the index of this array a[0]="Test"; DMD says the array isn't mutable...even if these are n

Re: Compilation constants

2009-11-12 Thread Phil Deets
On Thu, 12 Nov 2009 07:17:57 -0500, Chris Nicholson-Sauls wrote: Phil Deets wrote: On Wed, 11 Nov 2009 13:45:17 -0500, grauzone wrote: You can delete your posts to emulate editing... I didn't know it was possible to delete posts from a newsgroup. How do you do that? I don&#

Re: Compilation constants

2009-11-11 Thread Phil Deets
On Wed, 11 Nov 2009 13:45:17 -0500, grauzone wrote: You can delete your posts to emulate editing... I didn't know it was possible to delete posts from a newsgroup. How do you do that? -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Re: Compilation constants

2009-11-11 Thread Phil Deets
On Wed, 11 Nov 2009 13:30:17 -0500, Phil Deets wrote: On Wed, 11 Nov 2009 08:50:48 -0500, bearophile wrote: In a C program I have a numeric constant SIZE (that is in [1,32]), that I can define when I compile the code, like this: gcc -DSIZE=14 ... How can I do the same thing in D? The

Re: Compilation constants

2009-11-11 Thread Phil Deets
On Wed, 11 Nov 2009 13:34:32 -0500, Phil Deets wrote: On Wed, 11 Nov 2009 13:30:17 -0500, Phil Deets wrote: On Wed, 11 Nov 2009 08:50:48 -0500, bearophile wrote: In a C program I have a numeric constant SIZE (that is in [1,32]), that I can define when I compile the code, like this

Re: Compilation constants

2009-11-11 Thread Phil Deets
On Wed, 11 Nov 2009 08:50:48 -0500, bearophile wrote: In a C program I have a numeric constant SIZE (that is in [1,32]), that I can define when I compile the code, like this: gcc -DSIZE=14 ... How can I do the same thing in D? The solution I have found is to put in the D code: version(B

Re: version specific enum members

2009-10-30 Thread Phil Deets
On Fri, 30 Oct 2009 06:38:44 -0500, Ary Borenszweig wrote: Phil Deets wrote: On Thu, 29 Oct 2009 18:28:12 -0500, Ary Borenszweig wrote: Ellery Newcomer wrote: Unfortunately, that's going to be about the best you can do, unless you're willing to play with string mixins and

Re: version specific enum members

2009-10-29 Thread Phil Deets
On Fri, 30 Oct 2009 00:03:23 -0500, Daniel Keep wrote: Phil Deets wrote: Hi, is there a way to add members to an enum based on conditional compilation symbols. I tried enum Tag { A, B, version (symbol) { C, D, } E, } but it doesn't work. I know I could do ve

Re: version specific enum members

2009-10-29 Thread Phil Deets
On Thu, 29 Oct 2009 18:28:12 -0500, Ary Borenszweig wrote: Ellery Newcomer wrote: Phil Deets wrote: Hi, is there a way to add members to an enum based on conditional compilation symbols. I tried enum Tag { A, B, version (symbol) { C, D, } E, } but it doesn't wo

version specific enum members

2009-10-29 Thread Phil Deets
Hi, is there a way to add members to an enum based on conditional compilation symbols. I tried enum Tag { A, B, version (symbol) { C, D, } E, } but it doesn't work. I know I could do version (symbol) { enum Tag { A, B, C, D, E } } else { enum Tag { A, B, E } } but I d

Re: some questions about D

2009-10-23 Thread Phil Deets
On Thu, 22 Oct 2009 11:50:51 -0500, Luis P. Mendes wrote: 5) Besides Alexei forthcoming book, is there documentation for the whole language and not only to part of it as in http://compsci.ca/v3/ viewtopic.php?t=9518 and http://en.wikibooks.org/wiki/A_Beginner% 27s_Guide_to_D ? I remember wh

Re: amazing function behavior

2009-10-20 Thread Phil Deets
On Mon, 19 Oct 2009 02:39:57 -0500, Zarathustra wrote: Function is never called but why? look at: window.Window.wndProc : case WM.LBUTTONDOWN //__ module window; private import base; private import structs; private static import user32; private st

Re: looking for an IDE

2009-09-30 Thread Phil Deets
On Wed, 30 Sep 2009 15:49:33 -0500, Phil Deets wrote: On Wed, 30 Sep 2009 09:01:04 -0500, Trass3r wrote: Phil Deets schrieb: I tried Descent, but it didn't work well at all with my D2 program. It also didn't support building. I'll look into Poseidon. Thanks. D2 support

Re: looking for an IDE

2009-09-30 Thread Phil Deets
On Wed, 30 Sep 2009 09:05:37 -0500, A Bothe wrote: Hi, I think I've got what you want... http://www.alexanderbothe.com/?id=27 - the D-IDE I tried that. It has potential, but here is a list of problems I had: * Unpinned panels don't collapse until you unpin a second panel. * When I right-c

Re: looking for an IDE

2009-09-30 Thread Phil Deets
On Wed, 30 Sep 2009 09:01:04 -0500, Trass3r wrote: Phil Deets schrieb: I tried Descent, but it didn't work well at all with my D2 program. It also didn't support building. I'll look into Poseidon. Thanks. D2 support isn't that good in Descent yet. Building is su

Re: looking for an IDE

2009-09-30 Thread Phil Deets
On Wed, 30 Sep 2009 02:46:12 -0500, Saaa wrote: Phil Deets wrote I tried Descent, but it didn't work well at all with my D2 program. It also didn't support building. I'll look into Poseidon. Thanks. What exactly do you expect from supporting building? I use descent to buil

Re: looking for an IDE

2009-09-29 Thread Phil Deets
On Tue, 29 Sep 2009 20:09:44 -0500, Jeremie Pelletier wrote: Phil Deets wrote: Hi, I'm new to D and am mostly interested in D2. Is there a Windows IDE with support for D2 debugging, building, and basic code navigation (such as go to definition)? I've been trying a couple diff

looking for an IDE

2009-09-29 Thread Phil Deets
Hi, I'm new to D and am mostly interested in D2. Is there a Windows IDE with support for D2 debugging, building, and basic code navigation (such as go to definition)? I've been trying a couple different IDEs, but most seem to be focused towards D1. Another nice to have "feature" would be su