class x is hidden by y

2010-10-06 Thread Benjamin Thaut
For the following code in D 2.0 using dmd 2.049: import std.stdio; abstract class foo { protected: void WrongType(){ assert(0,"Using wrong type"); } public: void Update(int value){WrongType();} void Update(float value){WrongType();} } class blup :

Re: write to file ... trivial?

2010-10-06 Thread Jesse Phillips
Dr. Smith Wrote: > Thank you. Indeed, I forgot: auto f = File("outfile.txt", "w"); > > Interestingly, this apparently works within a for-loop to overwrite the file > on > the first iteration and appending otherwise (Should there not be an explicit > append arg?): > > for(int i = 0; i < 100; i+

Re: write to file ... trivial?

2010-10-06 Thread Dr. Smith
Thank you. Indeed, I forgot: auto f = File("outfile.txt", "w"); Interestingly, this apparently works within a for-loop to overwrite the file on the first iteration and appending otherwise (Should there not be an explicit append arg?): for(int i = 0; i < 100; i++) { f.writefln("%s%i", "World He

Re: write to file ... trivial?

2010-10-06 Thread Seth Hoenig
Here's a minimal little template (checked): import std.stdio; void main() { auto f = File("outfile.txt", "w"); f.writefln("%s World", "Hello"); f.close(); } 2010/10/6 Denis Koroskin <2kor...@gmail.com> > On Wed, 06 Oct 2010 22:43:42 +0400, Dr. Smith wrote: > > This

Re: write to file ... trivial?

2010-10-06 Thread Denis Koroskin
On Wed, 06 Oct 2010 22:43:42 +0400, Dr. Smith wrote: This should be trivial. However, I've not found in the documentation (trying both std.stdio and std.file) how to write to a file in the manner here: filename.writefln("%s\t%f", someString, someDouble); ... this merely prints filename to

write to file ... trivial?

2010-10-06 Thread Dr. Smith
This should be trivial. However, I've not found in the documentation (trying both std.stdio and std.file) how to write to a file in the manner here: filename.writefln("%s\t%f", someString, someDouble); ... this merely prints filename to screen ... does not create a data file.

Re: Using the llvm D-bindings [solved]

2010-10-06 Thread mwarning
On Wed, 06 Oct 2010 16:57:09 +0200, Manuel König wrote: > LLVM_LIBS=`llvm-config --libs | sed 's/-l/-L-l'` typo detected, you need: sed 's/-l/-L-l/g' :)

Re: Using the llvm D-bindings [solved]

2010-10-06 Thread Manuel König
The previous "Initial setup" description didn't pass the "copy paste" test, now it's more instructive. The same should work for llvm 2.6 and 2.8, too (yes, 2.8 was just released and the bindings are already there :) Initial setup: == svn co http://svn.dsource.org/projects/bindings/tru

Re: Using the llvm D-bindings [solved]

2010-10-06 Thread Manuel König
Am Wed, 6 Oct 2010 14:36:16 +0200 schrieb Manuel König : > > > > You should probably ask LDC guys (irc://irc.freenode.net/ldc) > > Thanks, I'll try. But I think the development of LDC was put on hold > due to lack of time and interest, let's see if I can find someone > there :) > Well, the cha

Re: Using the llvm D-bindings

2010-10-06 Thread Manuel König
Am Wed, 06 Oct 2010 16:27:11 +0400 schrieb "Denis Koroskin" <2kor...@gmail.com>: > On Wed, 06 Oct 2010 16:20:41 +0400, Manuel König > wrote: > > > Hi, > > > > did anyone have success using the llvm-2.7 D-bindings from the > > bindings project http://www.dsource.org/projects/bindings on x86_64 >

Re: Initialisation of static immutable arrays

2010-10-06 Thread Steven Schveighoffer
On Wed, 06 Oct 2010 08:21:08 -0400, Lars T. Kyllingstad wrote: On Wed, 06 Oct 2010 07:39:48 -0400, Steven Schveighoffer wrote: Of course. If you realize that the expression [1,2,3] is not immutable, then it makes sense. Another example to help you think about it: void foo(int x) { imm

Re: Using the llvm D-bindings

2010-10-06 Thread Denis Koroskin
On Wed, 06 Oct 2010 16:20:41 +0400, Manuel König wrote: Hi, did anyone have success using the llvm-2.7 D-bindings from the bindings project http://www.dsource.org/projects/bindings on x86_64 linux? I tried so far with ldc, but the compiler chokes about a mere 3570 lines of unresolved symbols w

Re: Initialisation of static immutable arrays

2010-10-06 Thread Denis Koroskin
On Wed, 06 Oct 2010 16:21:08 +0400, Lars T. Kyllingstad wrote: On Wed, 06 Oct 2010 07:39:48 -0400, Steven Schveighoffer wrote: On Wed, 06 Oct 2010 06:16:45 -0400, Lars T. Kyllingstad wrote: [...] Secondly, if the above is not true, how can I verify that the array in the following piece

Re: Initialisation of static immutable arrays

2010-10-06 Thread Lars T. Kyllingstad
On Wed, 06 Oct 2010 07:39:48 -0400, Steven Schveighoffer wrote: > On Wed, 06 Oct 2010 06:16:45 -0400, Lars T. Kyllingstad > wrote: > > [...] > >> Secondly, if the above is not true, how can I verify that the array in >> the following piece of code isn't allocated and/or copied anew every >> tim

Using the llvm D-bindings

2010-10-06 Thread Manuel König
Hi, did anyone have success using the llvm-2.7 D-bindings from the bindings project http://www.dsource.org/projects/bindings on x86_64 linux? I tried so far with ldc, but the compiler chokes about a mere 3570 lines of unresolved symbols when linking with ldc, compiling works fine. Short version:

Re: Associative arrays give compile error

2010-10-06 Thread Steven Schveighoffer
On Wed, 06 Oct 2010 08:12:28 -0400, bearophile wrote: Steven Schveighoffer: Casting to immutable is the only way to create such a beast. Then maybe we have to improve the language semantics to allow a better solution. See the Transients of Clojure or the larval objects of Java :-) The

Re: Associative arrays give compile error

2010-10-06 Thread bearophile
Steven Schveighoffer: > Casting to immutable is the only way to create such a beast. Then maybe we have to improve the language semantics to allow a better solution. See the Transients of Clojure or the larval objects of Java :-) The compiler may need to test (at compile time) that there's only

Re: Initialisation of static immutable arrays

2010-10-06 Thread Denis Koroskin
On Wed, 06 Oct 2010 15:39:48 +0400, Steven Schveighoffer wrote: BTW, I'm all for making array literals immutable. You can always make runtime-allocated arrays via a library function. -Steve I second that!

Re: Initialisation of static immutable arrays

2010-10-06 Thread Steven Schveighoffer
On Wed, 06 Oct 2010 06:16:45 -0400, Lars T. Kyllingstad wrote: I have a program that uses an immutable array, the contents of which are known at compile time. Thus, ideally, I want it to be placed in the .rodata segment of the program. Firstly, I seem to remember reading that using an array

Re: Associative arrays give compile error

2010-10-06 Thread Steven Schveighoffer
On Tue, 05 Oct 2010 22:02:30 -0400, bearophile wrote: Denis Koroskin: Compute mutable copy and then cast to immutable. Am I missing something? That's possible. But it's an exceptionally dirty thing, I am not sure it works in SafeD. A well designed const system has to offer a more clean

Re: Initialisation of static immutable arrays

2010-10-06 Thread Lars T. Kyllingstad
On Wed, 06 Oct 2010 10:16:45 +, Lars T. Kyllingstad wrote: > static immutable int[3] = [1, 2, 3]; ..should of course be static immutable int[3] a = [1, 2, 3]; -Lars

Initialisation of static immutable arrays

2010-10-06 Thread Lars T. Kyllingstad
I have a program that uses an immutable array, the contents of which are known at compile time. Thus, ideally, I want it to be placed in the .rodata segment of the program. Firstly, I seem to remember reading that using an array literal in D will always result in a heap allocation. Is this co

Re: Destruction Sequence: module and classes defined within

2010-10-06 Thread Lars T. Kyllingstad
On Tue, 05 Oct 2010 23:25:36 +0200, vano wrote: > The code below: > module used; > > import std.stdio; > > class ClassA { > this() { writeln("A ctor"); } > ~this() { writeln("A dtor"); } > } > > static this() { writeln("used.sctor"); } static ~this()