Re: copy and paste in program

2011-09-12 Thread Joel Christensen
I mean, I can't copy text from my program to the clipboard. - Joelcnz On 12-Sep-11 3:50 PM, Joel Christensen wrote: Thanks Jimmy. Your example worked. Or though I haven't managed to get the other way to work. [code] import std.stdio; //import core.stdc.string; import std.c.string; import

How to get WinDbg to show a call stack on Windows 7?

2011-09-12 Thread Don
I've set up a Windows 7 machine for working on DMD but I can't get windbg to work properly. Specifically, when I try to debug DMD itself, I don't get a call stack; I only see the current function. Everything else seems OK. Has anyone else experienced this? Any ideas?

Re: How to get WinDbg to show a call stack on Windows 7?

2011-09-12 Thread Trass3r
You could also use cv2pdb's -C option and Visual Studio to debug dmd.

Re: How do I create a module-local immutable class object?

2011-09-12 Thread Steven Schveighoffer
On Sat, 10 Sep 2011 17:06:44 -0400, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On 9/10/11, bearophile bearophileh...@lycos.com wrote: Andrej Mitrovic Wrote: Wait a minute, I've just realized private on a class definition has no effect. Why is that? Try to import that class from

Re: defining in What is the proper way in D2?

2011-09-12 Thread Steven Schveighoffer
On Sun, 11 Sep 2011 18:11:11 -0400, Timon Gehr timon.g...@gmx.ch wrote: On 09/11/2011 11:12 PM, Jonathan M Davis wrote: On Sunday, September 11, 2011 14:00:55 Charles Hixson wrote: On 09/11/2011 01:25 PM, Vladimir Panteleev wrote: On Sun, 11 Sep 2011 23:02:37 +0300, Charles Hixson

Re: inout and methods which return this

2011-09-12 Thread Steven Schveighoffer
On Sun, 11 Sep 2011 21:48:36 -0400, Vladimir Panteleev vladi...@thecybershadow.net wrote: What's the simplest const-correct way to write a method which returns this? I tried the following to no avail: class Test { inout(Test) f() inout { return this;

Re: defining in What is the proper way in D2?

2011-09-12 Thread Simen Kjaeraas
On Mon, 12 Sep 2011 00:11:11 +0200, Timon Gehr timon.g...@gmx.ch wrote: I think the fact that in for AAs returns a pointer is a mistake and ugly in the first place and any generic code that relies on any container to return a raw internal pointer is flawed by itself imho. If D had a

Re: defining in What is the proper way in D2?

2011-09-12 Thread Steven Schveighoffer
On Mon, 12 Sep 2011 10:10:35 -0400, Simen Kjaeraas simen.kja...@gmail.com wrote: On Mon, 12 Sep 2011 00:11:11 +0200, Timon Gehr timon.g...@gmx.ch wrote: I think the fact that in for AAs returns a pointer is a mistake and ugly in the first place and any generic code that relies on any

Re: defining in What is the proper way in D2?

2011-09-12 Thread Timon Gehr
On 09/12/2011 04:17 PM, Steven Schveighoffer wrote: On Mon, 12 Sep 2011 10:10:35 -0400, Simen Kjaeraas simen.kja...@gmail.com wrote: On Mon, 12 Sep 2011 00:11:11 +0200, Timon Gehr timon.g...@gmx.ch wrote: I think the fact that in for AAs returns a pointer is a mistake and ugly in the first

Re: defining in What is the proper way in D2?

2011-09-12 Thread Steven Schveighoffer
On Mon, 12 Sep 2011 10:24:52 -0400, Timon Gehr timon.g...@gmx.ch wrote: On 09/12/2011 04:17 PM, Steven Schveighoffer wrote: On Mon, 12 Sep 2011 10:10:35 -0400, Simen Kjaeraas simen.kja...@gmail.com wrote: On Mon, 12 Sep 2011 00:11:11 +0200, Timon Gehr timon.g...@gmx.ch wrote: I think the

Re: defining in What is the proper way in D2?

2011-09-12 Thread Timon Gehr
On 09/12/2011 04:34 PM, Steven Schveighoffer wrote: On Mon, 12 Sep 2011 10:24:52 -0400, Timon Gehr timon.g...@gmx.ch wrote: On 09/12/2011 04:17 PM, Steven Schveighoffer wrote: On Mon, 12 Sep 2011 10:10:35 -0400, Simen Kjaeraas simen.kja...@gmail.com wrote: On Mon, 12 Sep 2011 00:11:11

Re: defining in What is the proper way in D2?

2011-09-12 Thread Steven Schveighoffer
On Mon, 12 Sep 2011 11:02:20 -0400, Timon Gehr timon.g...@gmx.ch wrote: On 09/12/2011 04:34 PM, Steven Schveighoffer wrote: On Mon, 12 Sep 2011 10:24:52 -0400, Timon Gehr timon.g...@gmx.ch wrote: On 09/12/2011 04:17 PM, Steven Schveighoffer wrote: On Mon, 12 Sep 2011 10:10:35 -0400, Simen

Re: defining in What is the proper way in D2?

2011-09-12 Thread Timon Gehr
On 09/12/2011 05:16 PM, Steven Schveighoffer wrote: On Mon, 12 Sep 2011 11:02:20 -0400, Timon Gehr timon.g...@gmx.ch wrote: On 09/12/2011 04:34 PM, Steven Schveighoffer wrote: On Mon, 12 Sep 2011 10:24:52 -0400, Timon Gehr timon.g...@gmx.ch wrote: On 09/12/2011 04:17 PM, Steven

Re: defining in What is the proper way in D2?

2011-09-12 Thread Steven Schveighoffer
On Mon, 12 Sep 2011 11:23:36 -0400, Timon Gehr timon.g...@gmx.ch wrote: On 09/12/2011 05:16 PM, Steven Schveighoffer wrote: On Mon, 12 Sep 2011 11:02:20 -0400, Timon Gehr timon.g...@gmx.ch wrote: On 09/12/2011 04:34 PM, Steven Schveighoffer wrote: On Mon, 12 Sep 2011 10:24:52 -0400, Timon

Re: defining in What is the proper way in D2?

2011-09-12 Thread Jonathan M Davis
On Monday, September 12, 2011 17:23:36 Timon Gehr wrote: On 09/12/2011 05:16 PM, Steven Schveighoffer wrote: I'd say the array had to be a literal, or guaranteed sorted to support in. I'm not sure that's a great thing. But in order to do all this, we have to consider that a *lot* of code

Re: copy and paste in program

2011-09-12 Thread Jimmy Cao
The other way is a bit more complicated. Try this: import std.stdio; import core.stdc.string; import std.string; extern(Windows) { bool OpenClipboard(void*); void* GetClipboardData(uint); void* SetClipboardData(uint, void*); bool EmptyClipboard(); bool CloseClipboard(); void*

Re: copy and paste in program

2011-09-12 Thread Joel Christensen
Thanks so much Jimmy. You put in a bit of effort. :-) I just added this code to my general library: extern(Windows) { bool OpenClipboard(void*); void* GetClipboardData(uint); void* SetClipboardData(uint, void*); bool EmptyClipboard(); bool CloseClipboard(); void*

A question about purity

2011-09-12 Thread bearophile
A D2 program: struct Foo { int x; static int y; pure void foo1() { this.x++; } static pure void foo2() { Foo.y++; // line 8, error } } void main() {} With DMD 2.055 it gives at compile-time: test.d(8): Error: pure function 'foo2' cannot access mutable

Re: A question about purity

2011-09-12 Thread Jonathan M Davis
On Monday, September 12, 2011 15:24 bearophile wrote: A D2 program: struct Foo { int x; static int y; pure void foo1() { this.x++; } static pure void foo2() { Foo.y++; // line 8, error } } void main() {} With DMD 2.055 it gives at compile-time: test.d(8): Error: pure function

Re: How to get WinDbg to show a call stack on Windows 7?

2011-09-12 Thread Vladimir Panteleev
On Mon, 12 Sep 2011 14:00:51 +0300, Don nos...@nospam.com wrote: I don't get a call stack; I only see the current function. Generally (not specific to DMD or WinDbg), this is a sign that the executable was compiled without stack frames (or that the stack is corrupted). -- Best regards,

Converting Duration to TickDuration

2011-09-12 Thread Vladimir Panteleev
The simplest way I found is: TickDuration.from!hnsecs(duration.total!hnsecs) Is there a simpler way? -- Best regards, Vladimirmailto:vladi...@thecybershadow.net

Re: defining in What is the proper way in D2?

2011-09-12 Thread Vladimir Panteleev
On Mon, 12 Sep 2011 00:00:55 +0300, Charles Hixson charleshi...@earthlink.net wrote: On 09/11/2011 01:25 PM, Vladimir Panteleev wrote: On Sun, 11 Sep 2011 23:02:37 +0300, Charles Hixson charleshi...@earthlink.net wrote: I can't figure it out from

Re: Converting Duration to TickDuration

2011-09-12 Thread Jonathan M Davis
On Tuesday, September 13, 2011 04:32:28 Vladimir Panteleev wrote: The simplest way I found is: TickDuration.from!hnsecs(duration.total!hnsecs) Is there a simpler way? I don't believe so. A TickDuration can be cast (or use std.conv.to) to convert to a Duration, but there is no cast in the

Re: Converting Duration to TickDuration

2011-09-12 Thread Vladimir Panteleev
On Tue, 13 Sep 2011 05:01:31 +0300, Jonathan M Davis jmdavisp...@gmx.com wrote: What are you doing that you want to create a TickDuration from a Duration? On the one side, I have a module for running scheduled events. Event timing is specified using a TickDuration, indicating the time

Re: Converting Duration to TickDuration

2011-09-12 Thread Jonathan M Davis
On Tuesday, September 13, 2011 05:13:02 Vladimir Panteleev wrote: On Tue, 13 Sep 2011 05:01:31 +0300, Jonathan M Davis jmdavisp...@gmx.com wrote: What are you doing that you want to create a TickDuration from a Duration? On the one side, I have a module for running scheduled events.

Is this a bug?

2011-09-12 Thread Caligo
Trying to help someone on SO, I ran into problems. On a 64-bit Linux machine, with DMD 2.055 This gives: '/Internal error: ../ztc/cg87.c 202' void main(){ auto f = (double m){ static double sum = 0.0; return sum += m * m; }; double[] a = array(map!f(iota(1.0, 25.0, 1.0))); writeln(a); }

Re: Is this a bug?

2011-09-12 Thread Jonathan M Davis
On Monday, September 12, 2011 22:31:33 Caligo wrote: Trying to help someone on SO, I ran into problems. On a 64-bit Linux machine, with DMD 2.055 This gives: '/Internal error: ../ztc/cg87.c 202' void main(){ auto f = (double m){ static double sum = 0.0; return sum += m * m; }; double[]

Re: Is this a bug?

2011-09-12 Thread Caligo
Great. So is it a known bug? On Mon, Sep 12, 2011 at 10:35 PM, Jonathan M Davis jmdavisp...@gmx.comwrote: On Monday, September 12, 2011 22:31:33 Caligo wrote: Trying to help someone on SO, I ran into problems. On a 64-bit Linux machine, with DMD 2.055 This gives: '/Internal error:

Re: Is this a bug?

2011-09-12 Thread Jonathan M Davis
On Monday, September 12, 2011 22:38:25 Caligo wrote: Great. So is it a known bug? I don't know. You'd have to search bugzilla: d.puremagic.com/issues - Jonathan M Davis

Re: Is this a bug?

2011-09-12 Thread Caligo
On Mon, Sep 12, 2011 at 10:44 PM, Jonathan M Davis jmdavisp...@gmx.comwrote: On Monday, September 12, 2011 22:38:25 Caligo wrote: Great. So is it a known bug? I don't know. You'd have to search bugzilla: d.puremagic.com/issues - Jonathan M Davis Searching bugzilla (horrible technology)