Re: passing a string with the character as an argument

2012-02-29 Thread Andrej Mitrovic
On 2/29/12, James Miller ja...@aatch.net wrote: Today I Learned that windows has insane escaping. You won't have to worry about it for long: https://github.com/D-Programming-Language/phobos/pull/457

Re: Random behavior using a wrapped C library

2012-02-29 Thread simendsjo
On Wed, 29 Feb 2012 07:44:23 +0100, James Miller ja...@aatch.net wrote: On 29 February 2012 19:30, simendsjo simend...@gmail.com wrote: On Wed, 29 Feb 2012 05:03:30 +0100, Mike Parker aldac...@gmail.com wrote: On 2/29/2012 1:10 AM, simendsjo wrote: On Tue, 28 Feb 2012 16:58:13 +0100,

Re: Pretty fields string

2012-02-29 Thread Andrej Mitrovic
Just noticed there's an std.traits import missing. I hate how D silently ignores that FunctionTypeOf is left undefined.

How can I use structs in a named enum?

2012-02-29 Thread simendsjo
.. That is enum E : Struct {} struct S { int a; } // ok enum E : S { a = S(1), } // Error: need member function opCmp() for struct S to compare /* enum E2 : S { a = S(1), b = S(2) } */ struct S2 { int a; int opCmp(ref const S2 other) { return a == other.a

Re: How can I use structs in a named enum?

2012-02-29 Thread simendsjo
On Wed, 29 Feb 2012 12:27:32 +0100, simendsjo simend...@gmail.com wrote: On Wed, 29 Feb 2012 12:15:35 +0100, simendsjo simend...@gmail.com wrote: .. That is enum E : Struct {} struct S { int a; } // ok enum E : S { a = S(1), } // Error: need member function opCmp() for struct

about std.csv and derived format

2012-02-29 Thread bioinfornatics
Dear, I would like to parse this file: http://genome.ucsc.edu/goldenPath/help/ItemRGBDemo.txt struct Bed{ stringchrom;// 0 size_tchromStart; // 1 size_tchromEnd; // 2 stringname; // 3 size_tscore;// 4

Re: about std.csv and derived format

2012-02-29 Thread bioinfornatics
Le mercredi 29 février 2012 à 12:42 +0100, bioinfornatics a écrit : Dear, I would like to parse this file: http://genome.ucsc.edu/goldenPath/help/ItemRGBDemo.txt struct Bed{ stringchrom;// 0 size_tchromStart; // 1 size_tchromEnd; // 2

Re: about std.csv and derived format

2012-02-29 Thread Jesse Phillips
On Wednesday, 29 February 2012 at 11:51:29 UTC, bioinfornatics wrote: Le mercredi 29 février 2012 à 12:42 +0100, bioinfornatics a écrit : Dear, I would like to parse this file: http://genome.ucsc.edu/goldenPath/help/ItemRGBDemo.txt My problem is: - need to parse data in csv format - how

Re: How can I use structs in a named enum?

2012-02-29 Thread bearophile
simendsjo: Perhaps also the documentation for opCmp should be improved..? Also, and maybe here DMD has to give better error messages :-) Bye, bearophile

Re: How can I use structs in a named enum?

2012-02-29 Thread simendsjo
On Wed, 29 Feb 2012 13:40:51 +0100, bearophile bearophileh...@lycos.com wrote: simendsjo: Perhaps also the documentation for opCmp should be improved..? Also, and maybe here DMD has to give better error messages :-) Bye, bearophile Yes. Using argument types E3 doesn't make much sense

Re: More general Cartesian product

2012-02-29 Thread Philippe Sigaud
I have a need for a Cartesian product of multiple ranges. I see there's been a discussion here (Dec 2011) as well as a request posted (#7128). It seems to me that the request deals with a multidimensional product -- which is what I need -- while the implementation by Timon Gehr deals only with

Re: Pretty fields string

2012-02-29 Thread Philippe Sigaud
I've done this a couple of times before but I always had issues, e.g. functions and property calls would be mixed in. But I think I have a good go-to function now: Nice. What does it give for: - function overloads (PITA that)? - type aliase (alias int Int;)? - function aliases or member

Re: passing a string with the character as an argument

2012-02-29 Thread jic
James Miller Wrote: On 29 February 2012 20:21, Jos van Uden user@domain.invalid wrote: On 29-2-2012 7:06, James Miller wrote: On 29 February 2012 18:51, jiccabr...@wrc.xerox.com  wrote: Greetings! I have this program, import std.process : system; import std.stdio; int

Re: More general Cartesian product

2012-02-29 Thread Magnus Lie Hetland
On 2012-02-29 14:24:36 +, Philippe Sigaud said: [snip] Thanks for the response. In the meantime, I also hacked together a simple version of what I needed (see below), but I'll look into the references you provided as well :) void forall(alias func, size_t lvl=0, T...)(T args) {

Re: Pretty fields string

2012-02-29 Thread Jacob Carlborg
On 2012-02-29 10:58, Andrej Mitrovic wrote: I've done this a couple of times before but I always had issues, e.g. functions and property calls would be mixed in. But I think I have a good go-to function now: import std.algorithm; import std.conv; import std.string; import std.stdio; import

Re: Trouble with -lib in linux undefined reference to `_Dmain'

2012-02-29 Thread Kevin Cox
I think you need the -lib in the linker command (too?). On Feb 29, 2012 12:25 PM, André an...@s-e-a-p.de wrote: Hi, I use Mono-D and have a hello world example which compiles fine. I set the compiler option -lib and receives an error undefined reference to `_Dmain'. Following commands are

Re: Trouble with -lib in linux undefined reference to `_Dmain'

2012-02-29 Thread André
you are right, that was the error. Thanks. Kind regards André Am 29.02.2012 18:27, schrieb Kevin Cox: I think you need the -lib in the linker command (too?). On Feb 29, 2012 12:25 PM, André an...@s-e-a-p.de mailto:an...@s-e-a-p.de wrote: Hi, I use Mono-D and have a hello world

Re: How can I use structs in a named enum?

2012-02-29 Thread bearophile
simendsjo: Yes. Using argument types E3 doesn't make much sense when the named enum is a complex type. If this diagnostic bug/enhancement is not in Bugzilla then I suggest you to add it. Now there are two persons that are quite efficient at fixing Bugzilla bugs, but they need to know there

Re: How can I use structs in a named enum?

2012-02-29 Thread Jonathan M Davis
On Wednesday, February 29, 2012 12:15:35 simendsjo wrote: .. That is enum E : Struct {} struct S { int a; } // ok enum E : S { a = S(1), } // Error: need member function opCmp() for struct S to compare /* enum E2 : S { a = S(1), b = S(2) } */ struct S2 { int a; int

Re: Compiling DMD on MAC OS X

2012-02-29 Thread Joshua Niehus
On Monday, 20 February 2012 at 11:18:34 UTC, Tyro[a.c.edwards] wrote: ... and I doubt you want me to put all of what dmd -v spits out for this little script. Thanks, Andrew Hi Andrew, I ran into this problem as well and here is how I fixed/hacked it: OSX Lion, and soon to be Mountain

Re: How can I use structs in a named enum?

2012-02-29 Thread simendsjo
On Wed, 29 Feb 2012 19:00:10 +0100, bearophile bearophileh...@lycos.com wrote: simendsjo: Yes. Using argument types E3 doesn't make much sense when the named enum is a complex type. If this diagnostic bug/enhancement is not in Bugzilla then I suggest you to add it. Now there are two

Re: Pretty fields string

2012-02-29 Thread Andrej Mitrovic
On 2/29/12, Jacob Carlborg d...@me.com wrote: Seems like what I have in my serialization library Orange: Sweet. I was gonna take a look at Orange for just this purpose. Thanks.

Re: class templates and static if

2012-02-29 Thread Ali Çehreli
On 02/28/2012 02:12 AM, Dmitry Olshansky wrote: On 28.02.2012 2:17, Ali Çehreli wrote: I have played with this optimization recently. (Could be dmd 2.057.) No, dmd did not optimize a straightforward switch statement over a ubyte expression with about two hundred ubyte cases. Hate to say it

Re: Pretty fields string

2012-02-29 Thread Andrej Mitrovic
On 2/29/12, Philippe Sigaud philippe.sig...@gmail.com wrote: Nice. What does it give for: - function overloads (PITA that)? - type aliase (alias int Int;)? - function aliases or member aliases? - inner templates (struct template, etc, not pure template as these are not allowed in a struct)?

Re: Pretty fields string

2012-02-29 Thread Andrej Mitrovic
On 2/29/12, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: Just noticed it doesn't work ok if there's a nested template declaration in a struct. It would say Error: cannot resolve type for t.temp(T). Correction: it was the unittest block that was problematic. I've filed it

how to use raw sockets

2012-02-29 Thread maarten van damme
hello, I want to use raw sockets but there is a lack of documentation on how to use them in D. Is there somewhere I can read more about them or has someone succesfully used them? Thank you, maarten

GUI or more human readable -profile data?

2012-02-29 Thread simendsjo
http://www.digitalmars.com/ctg/trace.html Has someone made some GUI/pretty printing/dump to database or other tools to make the profile data a bit simpler to digest?

Re: how to use raw sockets

2012-02-29 Thread David
Am 29.02.2012 20:44, schrieb maarten van damme: hello, I want to use raw sockets but there is a lack of documentation on how to use them in D. Is there somewhere I can read more about them or has someone succesfully used them? Thank you, maarten Hello, I would use libpcap for that, since

Re: how to use raw sockets

2012-02-29 Thread maarten van damme
I've tried porting libcap once but I failed miserably. If I'd succeed in porting they wouldn't be of good quality.

Re: GUI or more human readable -profile data?

2012-02-29 Thread Robert Clipsham
On 29/02/2012 19:41, simendsjo wrote: http://www.digitalmars.com/ctg/trace.html Has someone made some GUI/pretty printing/dump to database or other tools to make the profile data a bit simpler to digest? If you're on Windows you could try: http://h3.gd/code/xfProf/ Although I don't believe

Re: GUI or more human readable -profile data?

2012-02-29 Thread simendsjo
On Wed, 29 Feb 2012 22:28:29 +0100, Robert Clipsham rob...@octarineparrot.com wrote: On 29/02/2012 19:41, simendsjo wrote: http://www.digitalmars.com/ctg/trace.html Has someone made some GUI/pretty printing/dump to database or other tools to make the profile data a bit simpler to digest?

Re: GUI or more human readable -profile data?

2012-02-29 Thread Andrej Mitrovic
Boom: https://bitbucket.org/stqn/profiled I've never used it though.

Re: how to use raw sockets

2012-02-29 Thread James Miller
On 1 March 2012 10:05, maarten van damme maartenvd1...@gmail.com wrote: I've tried porting libcap once but I failed miserably. If I'd succeed in porting they wouldn't be of good quality. Not porting, writing bindings for it. Its pretty easy. just convert the declarations into D extern (C) {

Re: how to use raw sockets

2012-02-29 Thread maarten van damme
thank you, I'll give it a try. One of my previous attempts failed because I didn't know what was really needed to include in the bindings and what was excess. I'm going to post what I have in a week, hope it works out.

Re: GUI or more human readable -profile data?

2012-02-29 Thread Jonathan M Davis
On Thursday, March 01, 2012 00:17:55 Robert Clipsham wrote: Just as a side note, -profile doesn't work with multi-threaded applications, so using some other profiler would probably be a better bet anyway. It doesn't work with 64-bit programs either. - Jonathan M Davis

Re: about std.csv and derived format

2012-02-29 Thread bioinfornatics
Le mercredi 29 février 2012 à 13:23 +0100, Jesse Phillips a écrit : On Wednesday, 29 February 2012 at 11:51:29 UTC, bioinfornatics wrote: Le mercredi 29 février 2012 à 12:42 +0100, bioinfornatics a écrit : Dear, I would like to parse this file:

Regarding std.array.Appender

2012-02-29 Thread bearophile
Do you know why std.array.Appender defines a put method instead of overloading the ~= operator? Bye and thank you, bearophile

Re: Regarding std.array.Appender

2012-02-29 Thread Jonathan M Davis
On Wednesday, February 29, 2012 20:25:35 bearophile wrote: Do you know why std.array.Appender defines a put method instead of overloading the ~= operator? put is a function on output ranges, and Appender is an output range. - Jonathan M Davis

Re: Regarding std.array.Appender

2012-02-29 Thread Andrej Mitrovic
Luckily you can always use alias this and overload opCatAssign. 'alias this' is a great tool for customizing APIs. :)

Re: Regarding std.array.Appender

2012-02-29 Thread Jonathan M Davis
On Wednesday, February 29, 2012 20:53:04 Jonathan M Davis wrote: On Wednesday, February 29, 2012 20:25:35 bearophile wrote: Do you know why std.array.Appender defines a put method instead of overloading the ~= operator? put is a function on output ranges, and Appender is an output range.

Re: about std.csv and derived format

2012-02-29 Thread bioinfornatics
Le jeudi 01 mars 2012 à 01:52 +0100, bioinfornatics a écrit : Le mercredi 29 février 2012 à 13:23 +0100, Jesse Phillips a écrit : On Wednesday, 29 February 2012 at 11:51:29 UTC, bioinfornatics wrote: Le mercredi 29 février 2012 à 12:42 +0100, bioinfornatics a écrit : Dear, I

Re: Regarding std.array.Appender

2012-02-29 Thread bearophile
Jonathan M Davis: put is a function on output ranges, and Appender is an output range. Also, given that it doesn't define ~ (and it wouldn't really make sense for it to), it would be very weird IMHO to define ~=. I don't understand why that's weird. In Java you can't overload an append

Re: Regarding std.array.Appender

2012-02-29 Thread Adam D. Ruppe
On Thursday, 1 March 2012 at 02:23:55 UTC, bearophile wrote: But for me it's weird that Appender doesn't use the D operator to _append_. [...] I suggest to give it both put method and ~= operator. I agree entirely. Another annoyance is if you have a function that works on regular arrays,

Re: Regarding std.array.Appender

2012-02-29 Thread Jonathan M Davis
On Wednesday, February 29, 2012 21:23:54 bearophile wrote: Jonathan M Davis: put is a function on output ranges, and Appender is an output range. Also, given that it doesn't define ~ (and it wouldn't really make sense for it to), it would be very weird IMHO to define ~=. I don't

Re: Regarding std.array.Appender

2012-02-29 Thread Jonathan M Davis
On Thursday, March 01, 2012 03:29:06 Adam D. Ruppe wrote: On Thursday, 1 March 2012 at 02:23:55 UTC, bearophile wrote: But for me it's weird that Appender doesn't use the D operator to _append_. [...] I suggest to give it both put method and ~= operator. I agree entirely. Another

Re: Regarding std.array.Appender

2012-02-29 Thread Adam D. Ruppe
On Thursday, 1 March 2012 at 02:44:35 UTC, Jonathan M Davis wrote: True, but it can't do all of the other operations that array can do either. Yeah, but the one operation it replaces, ~=, can be done on an array. If you're trying to convert array code to Appender for speed, most likely you're

Why do bitfields throw exceptions instead of wrapping?

2012-02-29 Thread ixid
In C++ this works: struct test { unsigned int h : 2; }; int main() { test b; b.h = 0; for(int i = 0;i 10;i++) ++b.h; return 0; } In D this throws an exception as soon as it wraps: struct test { mixin(bitfields!(

Re: Regarding std.array.Appender

2012-02-29 Thread James Miller
On 1 March 2012 15:49, Adam D. Ruppe destructiona...@gmail.com wrote: On Thursday, 1 March 2012 at 02:44:35 UTC, Jonathan M Davis wrote: True, but it can't do all of the other operations that array can do either. Yeah, but the one operation it replaces, ~=, can be done on an array. If

Re: Why do bitfields throw exceptions instead of wrapping?

2012-02-29 Thread James Miller
On 1 March 2012 16:15, ixid nuacco...@gmail.com wrote: In C++ this works: struct test {        unsigned int h : 2; }; int main() {        test b;        b.h = 0;        for(int i = 0;i 10;i++)                ++b.h;        return 0; } In D this throws an exception as soon as it

Re: Regarding std.array.Appender

2012-02-29 Thread Ali Çehreli
On 02/29/2012 08:28 PM, James Miller wrote: I understand that Appenders aren't arrays, and should not be used as such, but you /can/ use an array as an Appender. Yes you can but whatever you put() into the array is immediately popFront()'ed from the array. ;) You must use a temporary