Re: How to wrap SDL?

2011-01-24 Thread Stanislav Blinov
22.01.2011 23:04, Sean Eskapp пишет: I'm using the Derelict SDL bindings, and I'm wrapping some parts of SDL in my own objects. Originally, I was using classes, but this caused a number of errors when the program exited, since Derelict unloaded itself before the garbage collector took care of

non-constant error for module AAs

2011-01-24 Thread Andrej Mitrovic
Is this a bug? import std.stdio; string[string] values = [abc:abc, def:def]; void main() { string[string] values2 = [abc:abc, def:def]; } test.d(3): Error: non-constant expression [abc:abc,def:def] What's non-constant about that expression?

Re: Problems with MemoryStream

2011-01-24 Thread Ali Çehreli
Tobias Pankrath wrote: Hello, I just got my hands on a copy of TDPL and I like the book and D is very promising. But I run into problems with the easiest of program. I just want to write to and from a stream, just the way it is possible with C++ stringstreams. But this program produces an empty

C# code sample

2011-01-24 Thread pragma
Hi i come from a c# background I would like to write the following code in the according D style but i'm not sure howto do it c# code: void foo(IEnumerabledouble[] data) { foreach (var d in data) { do_some_stuff(d); } } i guess the D equivalent to IEnumerable is Range? how would it

Re: C# code sample

2011-01-24 Thread Simen kjaeraas
pragma the_ignora...@hotmail.com wrote: Hi i come from a c# background I would like to write the following code in the according D style but i'm not sure howto do it c# code: void foo(IEnumerabledouble[] data) { foreach (var d in data) { do_some_stuff(d); } } i guess the D

Re: C# code sample

2011-01-24 Thread Simen kjaeraas
Jesse Phillips jessekphillip...@gmail.com wrote: Simen kjaeraas Wrote: pragma the_ignora...@hotmail.com wrote: Hi i come from a c# background I would like to write the following code in the according D style but i'm not sure howto do it c# code: void foo(IEnumerabledouble[] data) {

Re: C# code sample

2011-01-24 Thread Steven Schveighoffer
On Mon, 24 Jan 2011 14:39:33 -0500, Simen kjaeraas simen.kja...@gmail.com wrote: pragma the_ignora...@hotmail.com wrote: Hi i come from a c# background I would like to write the following code in the according D style but i'm not sure howto do it c# code: void foo(IEnumerabledouble[]

Re: non-constant error for module AAs

2011-01-24 Thread spir
On 01/24/2011 04:45 PM, Andrej Mitrovic wrote: Is this a bug? import std.stdio; string[string] values = [abc:abc, def:def]; void main() { string[string] values2 = [abc:abc, def:def]; } test.d(3): Error: non-constant expression [abc:abc,def:def] What's non-constant about that

D1: out of memory

2011-01-24 Thread %u
How do I get dmd's memory usage a few hundred MBs down? I keep having to close everything in order not to get an out of memory error while compiling (-w -full). I'd like to get it from 700-800 to below 400 :) Any way to inspect which part is the biggest drain?

Re: D1: out of memory

2011-01-24 Thread %u
Er, bit exaggerated.. 450 to below 300 pls :)

Re: D1: out of memory

2011-01-24 Thread Robert Clipsham
On 24/01/11 22:14, %u wrote: How do I get dmd's memory usage a few hundred MBs down? I keep having to close everything in order not to get an out of memory error while compiling (-w -full). I'd like to get it from 700-800 to below 400 :) Any way to inspect which part is the biggest drain? CTFE

concatenation

2011-01-24 Thread Ellery Newcomer
in the following: void main(){ char[] x; string s; string y; y = s ~ x; } tok.d(5): Error: cannot implicitly convert expression (cast(const(char)[])s ~ x) of type char[] to string why should typeof(s ~ x) == char[] ?

Re: D1: out of memory

2011-01-24 Thread %u
== Quote from Robert Clipsham (rob...@octarineparrot.com)'s article CTFE and templates will use up the most memory - particularly if you use a lot of strings, as the memory allocated is never freed. You can work around it be compiling files one at a time or a few at a time, so instead of: $

Re: concatenation

2011-01-24 Thread Robert Clipsham
On 24/01/11 23:09, Ellery Newcomer wrote: in the following: void main(){ char[] x; string s; string y; y = s ~ x; } tok.d(5): Error: cannot implicitly convert expression (cast(const(char)[])s ~ x) of type char[] to string why should typeof(s ~ x) == char[] ? x is a mutable array of mutable

Re: concatenation

2011-01-24 Thread Simen kjaeraas
Ellery Newcomer ellery-newco...@utulsa.edu wrote: in the following: void main(){ char[] x; string s; string y; y = s ~ x; } tok.d(5): Error: cannot implicitly convert expression (cast(const(char)[])s ~ x) of type char[] to string why should typeof(s ~ x) == char[] ?

Re: non-constant error for module AAs

2011-01-24 Thread Andrej Mitrovic
On 1/24/11, BlazingWhitester max.kl...@gmail.com wrote: On 2011-01-24 17:45:03 +0200, Andrej Mitrovic said: Is this a bug? import std.stdio; string[string] values = [abc:abc, def:def]; void main() { string[string] values2 = [abc:abc, def:def]; } test.d(3): Error: non-constant

Re: concatenation

2011-01-24 Thread Simon Buerger
On 25.01.2011 00:22, Robert Clipsham wrote: If you append something mutable to something immutable, the resulting type must be mutable, as some of the contents is mutable and could be changed - if that can happen the result can't be immutable. To get around this there's .idup I believe. This

Re: non-constant error for module AAs

2011-01-24 Thread bearophile
Andrej Mitrovic: It's interesting that enum works but immutable doesn't. enum will do, Thanks. But there are some problems with enum AAs. Take a look at this little program: enum int[int] aa = [1:2, 3:4]; int foo(int x) { return aa[x]; } void main() {} And the asm of foo():