Re: Print a PDF

2008-12-09 Thread BLS
John schrieb: BCS Wrote: Reply to John, Hello! I'm wanting to use D to send a PDF to a printer. Is there an easy way to do this? Also, I may need to set which tray to go to and whether it should duplex or not. Could someone help me out? THANKS! You would do it the same way that it would

CTFE - filling an array

2008-12-09 Thread The Anh Tran
Hi, I would like to pre-create a double array, each element is calculated by a function. //- import std.stdio; import std.conv; import std.string; template f(int N) { bool fn(double[] tb) { for (int i = 1; i

Re: Cyclic Dependencies

2008-12-09 Thread Derek Parnell
On Tue, 09 Dec 2008 01:26:29 -0600, Ellery Newcomer wrote: wchar[] w = (true)? true:false; -- Error: cannot implicitly convert expression (true) of type char[] to wchar[] or should it be reported as a bug? It is not a bug. A string literal such as true is a char[] type (UTF8), and

Re: Cyclic Dependencies

2008-12-09 Thread torhu
Ellery Newcomer wrote: When I first started learning D I decided that a good way to learn it would be by porting a popular java api (mind, I didn't say intelligent), which came complete with a few cyclic dependencies. At the moment, I'm using GDC, and it refuses to swallow cyclic dependencies.

Re: Cyclic Dependencies

2008-12-09 Thread Lars Ivar Igesund
Ellery Newcomer wrote: Hello all, I began learning D a few months ago, and now I have a question about cyclic dependencies (and some random whining). I come from a java background and have had no serious exposure to C++. In java, cyclic dependencies are legit to the best of my knowledge.

Re: Cyclic Dependencies

2008-12-09 Thread Denis Koroskin
On Tue, 09 Dec 2008 10:26:29 +0300, Ellery Newcomer [EMAIL PROTECTED] wrote: Also, I would be trying to compile with DMD, but I have evidently managed to crash the compiler, and I don't know if it's DMD's fault or mine. It reports an Internal Error in e2ir.c at line 3904. (not being a C++

Re: Print a PDF

2008-12-09 Thread John
BLS Wrote: John schrieb: BCS Wrote: Reply to John, Hello! I'm wanting to use D to send a PDF to a printer. Is there an easy way to do this? Also, I may need to set which tray to go to and whether it should duplex or not. Could someone help me out? THANKS! You would

Re: Inline Assembler: Getting the offset of a label. How?

2008-12-09 Thread Kagamin
poly Wrote: asm { call Label1; Label1: pop ECX; mov EAX, Label1; //error reported on this line } I tried several tricks, seems like compiler doesn't support this.

Re: Freeing of memory (garbage collection)

2008-12-09 Thread bearophile
Dan W: 1: Even though D has an automatic garbage collector, is one still allowed to free the memory of a malloced array manually (using free () ), to avoid pauses in the program? Other people here will just answer your question. But remember that in D manual memory management is done only in

Re: CTFE - filling an array

2008-12-09 Thread Christopher Wright
The Anh Tran wrote: static double[N] dd = void; dd is not a compile-time constant. static auto tmp = f!(N).fn(dd); The initializer of tmp must be a compile-time constant, but since dd is not a compile-time constant, you can't use CTFE on fn.

Re: Freeing of memory (garbage collection)

2008-12-09 Thread Jarrett Billingsley
On Tue, Dec 9, 2008 at 9:42 AM, Jarrett Billingsley [EMAIL PROTECTED] wrote: On Tue, Dec 9, 2008 at 9:16 AM, Daniel White [EMAIL PROTECTED] wrote: Thanks for that reply. I wonder if extending automatic garbage collection for malloced memory would be a good idea... That would be a bad idea.

Re: Cyclic Dependencies

2008-12-09 Thread Jarrett Billingsley
On Tue, Dec 9, 2008 at 9:52 AM, Steven Schveighoffer [EMAIL PROTECTED] wrote: I'm not sure about this problem. I've not encountered it, but it sounds weird that it would cause a runtime error... It is weird. [a.d] module a; import b; static this(){} void main(){} [b.d] module

Re: Cyclic Dependencies

2008-12-09 Thread Ellery Newcomer
Derek Parnell wrote: It is not a bug. A string literal such as true is a char[] type (UTF8), and the compiler will not implicitly convert UTF8 to UTF16 (wchar[]). Which would then beg the obvious wchar[] w = true;

Re: Freeing of memory (garbage collection)

2008-12-09 Thread Jarrett Billingsley
On Tue, Dec 9, 2008 at 11:08 AM, Daniel White [EMAIL PROTECTED] wrote: That would be a bad idea. Then how would you do manual memory management in the few cases that absolutely require it? Two ways. Either: a: being able to lock the variable so that the garbage collector can't touch it

Re: Cyclic Dependencies

2008-12-09 Thread Ary Borenszweig
Jarrett Billingsley wrote: On Tue, Dec 9, 2008 at 12:00 PM, Ellery Newcomer [EMAIL PROTECTED] wrote: Derek Parnell wrote: It is not a bug. A string literal such as true is a char[] type (UTF8), and the compiler will not implicitly convert UTF8 to UTF16 (wchar[]). Which would then beg the

Re: Cyclic Dependencies

2008-12-09 Thread Steven Schveighoffer
Jarrett Billingsley wrote It can obviously be argued that since the operands of ?: are constant, the compiler _could_ figure out that they should be of type wchar[], but that would make the semantic analysis more complicated, and since appending 'w' to the strings is far easier, it probably

Nested Base classes

2008-12-09 Thread llee
I'm trying derive a class from a nested base class. The programs' structure is as follows: class A { class B { } } class C : A { class D : B { } } I'm using version 2.014 of the dmd compiler, and the above fails. The compiler error reports that B is nested in

Re: Nested Base classes

2008-12-09 Thread Jarrett Billingsley
On Tue, Dec 9, 2008 at 2:08 PM, llee [EMAIL PROTECTED] wrote: I'm trying derive a class from a nested base class. The programs' structure is as follows: class A { class B { } } class C : A { class D : B { } } I'm using version 2.014 of the dmd compiler,

Re: Nested Base classes

2008-12-09 Thread BCS
Reply to llee, I'm trying derive a class from a nested base class. The programs' structure is as follows: class A { class B { } } class C : A { class D : B { } } I'm using version 2.014 of the dmd compiler, and the above fails. The compiler error reports that B is nested in class A and not C.

Re: Freeing of memory (garbage collection)

2008-12-09 Thread Christopher Wright
Daniel White wrote: That would be a bad idea. Then how would you do manual memory management in the few cases that absolutely require it? Two ways. Either: a: being able to lock the variable so that the garbage collector can't touch it until you unlock it. If you have a reference to the

Re: myClass.add(something)(otherthings)(thisToo);

2008-12-09 Thread Denis Koroskin
On Wed, 10 Dec 2008 02:40:47 +0300, tsalm [EMAIL PROTECTED] wrote: Hello, How to implement an object that can do this : myClass.add(something)(otherthings)(thisToo); Is it possible ? TIA, TSalm Yes: import std.stdio; class MyClass { class MyClassAdder { MyClassAdder

Re: myClass.add(something)(otherthings)(thisToo);

2008-12-09 Thread BCS
Reply to TSalm, Hello, How to implement an object that can do this : myClass.add(something)(otherthings)(thisToo); Is it possible ? TIA, TSalm if you don't mind dropping the )( class C { final void add(T...)(T t) { foreach(int i,_;T) _add(t[i]); } //. }

Re: myClass.add(something)(otherthings)(thisToo);

2008-12-09 Thread Jarrett Billingsley
On Tue, Dec 9, 2008 at 7:00 PM, BCS [EMAIL PROTECTED] wrote: class C { final void add(T...)(T t) { foreach(int i,_;T) _add(t[i]); } //. } (new C).add(something, otherthings, thisToo); If all the params are the same type, typesafe variadics are a more