produced binary is quite big

2012-02-26 Thread Jabba Laci
Hi, I'm new to D. I tried the basic Hello World program (dmd hello.d) but it produced a 316 KB big binary. The same thing with C (gcc hello.c) is about 9 KB. Is there a way to reduce the size of the produced binary? Thanks, Laszlo

Syntax highlighting for CodeRunner

2012-02-26 Thread Joshua Niehus
In the off chance that some of you are running a Mac and using CodeRunner to play around with D, I cooked up the files you need for CodeRunner to highlight D's syntax: https://github.com/jniehus/Dlang-for-CodeRunner

Re: produced binary is quite big

2012-02-26 Thread James Miller
On 26 February 2012 21:28, Jabba Laci jabba.l...@gmail.com wrote: Hi, I'm new to D. I tried the basic Hello World program (dmd hello.d) but it produced a 316 KB big binary. The same thing with C (gcc hello.c) is about 9 KB. Is there a way to reduce the size of the produced binary? Thanks,

Re: Make alias parameter optional?

2012-02-26 Thread Ali Çehreli
On 02/25/2012 05:04 PM, Robert Rouse wrote: On Saturday, 25 February 2012 at 23:10:51 UTC, Ary Manzana wrote: On 2/25/12 7:31 PM, Robert Rouse wrote: ... This means that D can simulate Ruby blocks more than I thought. That's pretty awesome. I'm loving D more every day. How's that like a

Re: Supporting and signature-checking all foreach variations

2012-02-26 Thread Ali Çehreli
On 02/25/2012 08:25 AM, Ashish Myles wrote: I want to define a general-purpose centroid computer for point containers and ran into a couple of challenges. Firstly, here is the basic code Point3 computeCentroid(PointContainer)(const ref PointContainer C) if (...)// want a

Re: Make alias parameter optional?

2012-02-26 Thread Jacob Carlborg
On 2012-02-26 11:03, Ali Çehreli wrote: On 02/25/2012 05:04 PM, Robert Rouse wrote: On Saturday, 25 February 2012 at 23:10:51 UTC, Ary Manzana wrote: On 2/25/12 7:31 PM, Robert Rouse wrote: ... This means that D can simulate Ruby blocks more than I thought. That's pretty awesome. I'm

Re: struct init() method

2012-02-26 Thread Timon Gehr
On 02/26/2012 12:18 AM, Jonathan M Davis wrote: On Saturday, February 25, 2012 17:07:14 Timon Gehr wrote: This is useful: struct S{ @disable enum init = 0; } I thought that the way that you were supposed to do that was @disable this(); - Jonathan M Davis struct S{@disable this();}

Re: Syntax highlighting for CodeRunner

2012-02-26 Thread Jacob Carlborg
On 2012-02-26 10:26, Joshua Niehus wrote: In the off chance that some of you are running a Mac and using CodeRunner to play around with D, I cooked up the files you need for CodeRunner to highlight D's syntax: https://github.com/jniehus/Dlang-for-CodeRunner I'm using TextMate on Mac with D, it

Re: struct init() method

2012-02-26 Thread Jonathan M Davis
On Sunday, February 26, 2012 13:15:51 Alex Rønne Petersen wrote: On 26-02-2012 12:53, Jonathan M Davis wrote: On Sunday, February 26, 2012 12:48:06 Timon Gehr wrote: On 02/26/2012 12:18 AM, Jonathan M Davis wrote: On Saturday, February 25, 2012 17:07:14 Timon Gehr wrote: This is useful:

Re: produced binary is quite big

2012-02-26 Thread Trass3r
You may try -L--gc-sections (in case of gdc in combination with -ffunction-sections -fdata-sections) and -L-s

Re: SONAME and D

2012-02-26 Thread bioinfornatics
Le vendredi 24 février 2012 à 13:00 -0800, H. S. Teoh a écrit : On Fri, Feb 24, 2012 at 09:35:57PM +0100, Jordi Sayol wrote: Al 24/02/12 20:45, En/na H. S. Teoh ha escrit: [...] I personally think that phobos *should* be a shared object at some point, but not everyone agrees with me.

Re: SONAME and D

2012-02-26 Thread bioinfornatics
Le vendredi 24 février 2012 à 15:56 +0100, Mike Wey a écrit : On 02/23/2012 08:29 PM, bioinfornatics wrote: Le jeudi 23 février 2012 à 19:46 +0100, Mike Wey a écrit : On 02/23/2012 05:27 PM, bioinfornatics wrote: dear, for set soname with: - gdc: -Xlinker -soname myLib.so.1 - ldc2:

A very strange bug. DMD 2.058 64-bit Linux

2012-02-26 Thread Caligo
bug.d 88 @trusted: import std.datetime : benchmark; import std.stdio: writefln, writeln; alias double Real; void ben(alias fun)(string msg, uint n = 1_000_000) { auto b = benchmark!fun(n); writefln( %s %s ms, msg, b[0].to!(msecs, int)); }

Re: A very strange bug. DMD 2.058 64-bit Linux

2012-02-26 Thread Timon Gehr
On 02/26/2012 09:06 PM, Caligo wrote: Once you have those two files, compile with this: dmd -unittest t1.d bug.d and then run t1: ./t1 The output you get should look like this: ... [0, 4, 0, 0, 0, 0, 0, 2, 0, 0, 1, 2, 0, 1, 0, 0] I get: ... [0, 4, 0, 0, 0, 0, 0, 2, 0, 0, 1, 2, 0, 1, 0,

Re: A very strange bug. DMD 2.058 64-bit Linux

2012-02-26 Thread Caligo
Thanks. I have reported the bug: http://d.puremagic.com/issues/show_bug.cgi?id=7595

Re: SONAME and D

2012-02-26 Thread Mike Wey
On 02/26/2012 02:53 PM, bioinfornatics wrote: Le vendredi 24 février 2012 à 15:56 +0100, Mike Wey a écrit : On 02/23/2012 08:29 PM, bioinfornatics wrote: Le jeudi 23 février 2012 à 19:46 +0100, Mike Wey a écrit : On 02/23/2012 05:27 PM, bioinfornatics wrote: dear, for set soname with: - gdc:

Re: Make alias parameter optional?

2012-02-26 Thread Ali Çehreli
On 02/26/2012 03:45 AM, Jacob Carlborg wrote: On 2012-02-26 11:03, Ali Çehreli wrote: On 02/25/2012 05:04 PM, Robert Rouse wrote: On Saturday, 25 February 2012 at 23:10:51 UTC, Ary Manzana wrote: On 2/25/12 7:31 PM, Robert Rouse wrote: ... This means that D can simulate Ruby blocks

Re: Write struct to file

2012-02-26 Thread Chopin
Hello! OP here :) I'm gonna be more precise why I want this. I'm writing my own blog, I will write my own HTTP server etc. and the saving of the data myself. Everything will be done in D! Why? Learn D. I don't want to hear the reinvent the wheel :(, I think you learn a lot by doing thing like

class templates and static if

2012-02-26 Thread Tyler Jameson Little
So, here's my code, as it stands currently: import std.stdio; static enum Type { request, response }; class Parser(Type t) { static if (t == Type.request) { string name = request; } else { string name = response; } string message; this(string message) { this.message = message; } } void

Re: Write struct to file

2012-02-26 Thread Ali Çehreli
On 02/26/2012 03:22 PM, Chopin wrote: I don't want to hear the reinvent the wheel :(, I think you learn a lot by doing thing like this. Agreed. So, when I POST a blog-entry, I will read it, and write it to a file. I don't want write strings in a file, like: 1--||--Title--||--The

Re: std.socket with GDC

2012-02-26 Thread Mars
On Sunday, 26 February 2012 at 02:01:17 UTC, Andrew Wiley wrote: I recall having some issues because Winsock needs to be on the linker commandline *after* phobos. Try running with `gdc -v` to see what the linker commandline looks like. That's it... any way to get it in the correct order,

Re: Write struct to file

2012-02-26 Thread Andrej Mitrovic
On 2/27/12, Ali Çehreli acehr...@yahoo.com wrote: D is awesome compared to C as it enables serializing/deserializing data with its generic programming and compile-time reflection features like this: http://dlang.org/traits.html#allMembers ae's json uses .tupleof, and does it in 40(!)*

Re: class templates and static if

2012-02-26 Thread Andrej Mitrovic
The immutable is not necessary, use: auto h = new Parser!(Type.request)(Hello world); Otherwise, if you really want to declare the type instead of infering it you can write: Parser!(Type.request) h = new Parser!(Type.request)(Hello world); You can also do: Parser!(Type.request) h; h = new

Re: class templates and static if

2012-02-26 Thread James Miller
Also, 'static' on the enum declaration doesn't really do anything. :) but what if the immutable data changes?! :P But yeah, D's type inference is reasonably good (not as good as Haskell's, but nothing is as good as Haskell's), so doing what seems like the best way is normally the right way

Re: Supporting and signature-checking all foreach variations

2012-02-26 Thread Ashish Myles
On Sun, Feb 26, 2012 at 5:25 AM, Ali Çehreli acehr...@yahoo.com wrote: On 02/25/2012 08:25 AM, Ashish Myles wrote:    However the code above doesn't seem to work and requires me to    explicitly invoke the slice operator myself like      foreach(p; C[]) { ... }    when my data structure