Re: D at work

2012-02-08 Thread Jacob Carlborg
On 2012-02-09 02:13, Adam D. Ruppe wrote: The way I do it is to try updates at some point when I have a little free time. Get the new version, but keep the old version. Compile. If it works, sweet, probably ok to keep it. If your app doesn't compile, and it isn't an easy fix, just go back to t

Re: D at work

2012-02-08 Thread Jesse Phillips
On Thursday, 9 February 2012 at 01:08:39 UTC, Pedro Lacerda wrote: Hi all, I'm intern at a Java and Python company despite I spent most of my free time in there programming in D. Now I have a chance to use D on a low priority project. I want to know relevant use cases of D, because those at w

Re: D at work

2012-02-08 Thread bearophile
Pedro Lacerda: > Since still are many compiler bugs and phobos is changing quickly, is > better I stuck at some version (eg. 2.057), or "rolling release" is the > way to go? I am using "rolling" with D, but now I am doing it at a sub-release resolution. This means I keep my code updated about a

Re: is this a bug? opUnary!"++" Error: var has no effect

2012-02-08 Thread Timon Gehr
On 02/09/2012 12:47 AM, Zach the Mystic wrote: On 2/8/12 4:58 PM, Timon Gehr wrote: This is indeed a bug. The expression is rewritten internally into (pseudo code) (auto __pitmp1481 = has.myArc, has.myArc.opUnary!"++"(), __pitmp1481); This introduces a sub-expression with no effect. Is that

Re: D at work

2012-02-08 Thread Adam D. Ruppe
The way I do it is to try updates at some point when I have a little free time. Get the new version, but keep the old version. Compile. If it works, sweet, probably ok to keep it. If your app doesn't compile, and it isn't an easy fix, just go back to the old release. Every two or three releas

D at work

2012-02-08 Thread Pedro Lacerda
Hi all, I'm intern at a Java and Python company despite I spent most of my free time in there programming in D. Now I have a chance to use D on a low priority project. I want to know relevant use cases of D, because those at wiki aren't suited for my job. Good to know that Thrift is ready for use,

Re: linux linenumbers in stacktraces and druntime/phobos debug

2012-02-08 Thread bearophile
Vijay Nayar: > First, let's start with a simple program that segfaults due to a null > pointer. > > // File seg.d > class Dummy { > int a; > } > > void main() { > Dummy d; > d.a = 3; > } > > You compile and run the program with expected results. > > $ dmd seg.d > $ ./seg >

Re: is this a bug? opUnary!"++" Error: var has no effect

2012-02-08 Thread Zach the Mystic
On 2/8/12 4:58 PM, Timon Gehr wrote: This is indeed a bug. The expression is rewritten internally into (pseudo code) (auto __pitmp1481 = has.myArc, has.myArc.opUnary!"++"(), __pitmp1481); This introduces a sub-expression with no effect. Is that because has.myArc.opUnary!"++"() is going to be

Re: linux linenumbers in stacktraces and druntime/phobos debug builds..

2012-02-08 Thread Vijay Nayar
I actually ran into this myself while working on a pet game project, and here's what I do. First, let's start with a simple program that segfaults due to a null pointer. // File seg.d class Dummy { int a; } void main() { Dummy d; d.a = 3; } You compile and run the program with e

Re: A GUI library to begin with

2012-02-08 Thread AaronP
On 02/08/2012 09:24 AM, Jesse Phillips wrote: I think GtkD is stated to suck because it isn't native to Windows or Mac, both in look and availability. Hmm, perhaps. Incidentally, it looks great on Linux! :P

Re: is this a bug? opUnary!"++" Error: var has no effect

2012-02-08 Thread Timon Gehr
On 02/08/2012 10:48 PM, Zach the Mystic wrote: My goal is to be able to overload the "++" operator transparently to the code, but I can't. import std.stdio; struct Arc { int I = 0; // This is void, but the error appears under all return types void opUnary(string op)() if( op == "++" ) { ++I; }

is this a bug? opUnary!"++" Error: var has no effect

2012-02-08 Thread Zach the Mystic
My goal is to be able to overload the "++" operator transparently to the code, but I can't. import std.stdio; struct Arc { int I = 0; // This is void, but the error appears under all return types void opUnary(string op)() if( op == "++" ) { ++I; } } struct HasArc { Arc my

Re: Checking runtime object type

2012-02-08 Thread Steven Schveighoffer
On Wed, 08 Feb 2012 14:41:51 -0500, Jonathan M Davis wrote: On Wednesday, February 08, 2012 20:21:45 Johannes Pfau wrote: Am Wed, 8 Feb 2012 11:20:39 -0800 schrieb "H. S. Teoh" : > What's the correct syntax for checking the runtime type of a derived > > object given its base class pointer?

Re: Checking runtime object type

2012-02-08 Thread Jonathan M Davis
On Wednesday, February 08, 2012 20:21:45 Johannes Pfau wrote: > Am Wed, 8 Feb 2012 11:20:39 -0800 > > schrieb "H. S. Teoh" : > > What's the correct syntax for checking the runtime type of a derived > > > > object given its base class pointer? I tried: > > Base f() { return new Derived(); } > > Ba

Re: Checking runtime object type

2012-02-08 Thread Justin Whear
On Wed, 08 Feb 2012 11:20:39 -0800, H. S. Teoh wrote: > What's the correct syntax for checking the runtime type of a derived > object given its base class pointer? I tried: > > Base f() { return new Derived(); } > Base b = f(); > assert(is(typeof(b)==Derived)); > > but it throw

Re: Checking runtime object type

2012-02-08 Thread Johannes Pfau
Am Wed, 8 Feb 2012 11:20:39 -0800 schrieb "H. S. Teoh" : > What's the correct syntax for checking the runtime type of a derived > object given its base class pointer? I tried: > > Base f() { return new Derived(); } > Base b = f(); > assert(is(typeof(b)==Derived)); > > but it th

Checking runtime object type

2012-02-08 Thread H. S. Teoh
What's the correct syntax for checking the runtime type of a derived object given its base class pointer? I tried: Base f() { return new Derived(); } Base b = f(); assert(is(typeof(b)==Derived)); but it throws an error. Apparently typeof(b)==Base; so typeof returns only co

Re: Raw socket TCP/IP

2012-02-08 Thread Eyyub
BUMP, I really need help please ! Eyyub.

Re: Event library

2012-02-08 Thread Pedro Lacerda
Oh thanks, man. Pedro Lacerda 2012/2/8 bheads > On Wed, 08 Feb 2012 14:46:06 -0200, Pedro Lacerda wrote: > > You need to set the right libev version, and link with libev > > dmd main.d deimos/ev.d -I -L-lev -version=LIBEV4 > >

Re: Event library

2012-02-08 Thread bheads
On Wed, 08 Feb 2012 14:46:06 -0200, Pedro Lacerda wrote: You need to set the right libev version, and link with libev dmd main.d deimos/ev.d -I -L-lev -version=LIBEV4

Re: How to reverse char[]?

2012-02-08 Thread Jonathan M Davis
On Wednesday, February 08, 2012 17:52:17 Manfred Nowak wrote: > Jonathan M Davis wrote: > > thanks to how unicode works > > This does not mean, that the data structure representing a sequence of > "letters" has to follow exactly the "working" you cited above. That > data structure must only enable

Re: How to reverse char[]?

2012-02-08 Thread Jonathan M Davis
On Wednesday, February 08, 2012 09:35:28 H. S. Teoh wrote: > On Wed, Feb 08, 2012 at 08:32:32AM -0800, Jonathan M Davis wrote: > [...] > > > Except that char[] is _not_ an array of characters. It's an array of > > code units. There is a _big_ difference. Not even dchar[] is an array > > of charact

Re: How to reverse char[]?

2012-02-08 Thread Manfred Nowak
Jonathan M Davis wrote: > thanks to how unicode works This does not mean, that the data structure representing a sequence of "letters" has to follow exactly the "working" you cited above. That data structure must only enable it efficiently. If a requirement for sequences of letters is, that a

Re: Conversion to output ranges

2012-02-08 Thread Mafi
Am 07.02.2012 16:50, schrieb Timon Gehr: On 02/07/2012 04:49 PM, Timon Gehr wrote: On 02/07/2012 02:35 PM, Mafi wrote: Hi, does anybody know how to bring std.conv.to or something similar to output into an output range? int a = 42; char[25] buffer; to!typeof(buffer[])(a, buffer[]); I want to s

Re: How to reverse char[]?

2012-02-08 Thread H. S. Teoh
On Wed, Feb 08, 2012 at 08:32:32AM -0800, Jonathan M Davis wrote: [...] > Except that char[] is _not_ an array of characters. It's an array of > code units. There is a _big_ difference. Not even dchar[] is an array > of characters. It's both an array of code units and an array of code > points, bu

Event library

2012-02-08 Thread Pedro Lacerda
Hi all, I'm trying to do some evented programming and found libev at Deimos. I just want to auto loop = ev_default_loop(0); However I have no idea how to compile it. thanks, Pedro Lacerda

Re: How to reverse char[]?

2012-02-08 Thread Jonathan M Davis
On Wednesday, February 08, 2012 07:39:44 H. S. Teoh wrote: > On Wed, Feb 08, 2012 at 09:56:17AM -0500, Steven Schveighoffer wrote: > [...] > > > D will continue to trip over itself and fall into newbies until it > > makes a decision to make strings not also be arrays. > > [...] > > I disagree. D

Re: How to reverse char[]?

2012-02-08 Thread H. S. Teoh
On Wed, Feb 08, 2012 at 09:56:17AM -0500, Steven Schveighoffer wrote: [...] > D will continue to trip over itself and fall into newbies until it > makes a decision to make strings not also be arrays. [...] I disagree. D will continue to trip over itself until it treats all arrays equally, that is,

Re: How to reverse char[]?

2012-02-08 Thread Timon Gehr
On 02/08/2012 03:56 PM, Steven Schveighoffer wrote: On Wed, 08 Feb 2012 04:30:04 -0500, Jos van Uden wrote: On 8-2-2012 2:36, Timon Gehr wrote: char[] is handled by Phobos as a range of dchar, ergo it does not have swappable elements. I'm surprised that array.reverse does work (using 2.057

Re: A GUI library to begin with

2012-02-08 Thread Jesse Phillips
On Wednesday, 8 February 2012 at 03:55:41 UTC, Mr. Anonymous wrote: Hello, I want to start playing with D, and I'm looking at a GUI library to begin with. From what I see here: http://www.prowiki.org/wiki4d/wiki.cgi?GuiLibraries I have four choices: GtkD, DWT, DFL, DGui. Has anyone tried thes

Re: How to reverse char[]?

2012-02-08 Thread Steven Schveighoffer
On Wed, 08 Feb 2012 04:30:04 -0500, Jos van Uden wrote: On 8-2-2012 2:36, Timon Gehr wrote: char[] is handled by Phobos as a range of dchar, ergo it does not have swappable elements. I'm surprised that array.reverse does work (using 2.057) array.reverse is *not* the same as reverse(arra

Re: Using the Variant (Setting it's memory location)

2012-02-08 Thread Pedro Lacerda
Umm, sounds nice. If you want to store a long into buffer, you can cast the desired position as long* and assign the value. The following is adapted from std.outbuffer, that is another option. ubyte buffer[]; size_t offset; ulong a = 1; byte b = 2; // allocate space for ulong

Re: How to reverse char[]?

2012-02-08 Thread Jos van Uden
On 8-2-2012 2:36, Timon Gehr wrote: char[] is handled by Phobos as a range of dchar, ergo it does not have swappable elements. I'm surprised that array.reverse does work (using 2.057)

std.regex named matches

2012-02-08 Thread James Miller
Hi, I am using std.regex and using the named matches. I would like to be able to get at the names that have matched, since this is library code. e.g. auto m = match("test/2", regex(r"(?P\w+)/(?P\d)")); //either auto names = m.names; //or auto names = m.captures.names; or som

Re: Using the Variant (Setting it's memory location)

2012-02-08 Thread Era Scarecrow
On Tuesday, 7 February 2012 at 17:51:42 UTC, Pedro Lacerda wrote: You can roll your own tagged union instead. The S struct can store long and byte[], S.ptr is a pointer to the data. Yep, a bit like my code, except with switch cases covering all major types; That and trying to do comparison a

Re: A GUI library to begin with

2012-02-08 Thread AaronP
On 02/07/2012 09:55 PM, Mr. Anonymous wrote: Hello, I want to start playing with D, and I'm looking at a GUI library to begin with. From what I see here: http://www.prowiki.org/wiki4d/wiki.cgi?GuiLibraries I have four choices: GtkD, DWT, DFL, DGui. Has anyone tried these? Any suggestions? What