Re: Method invocation -- why it's not working?

2012-03-07 Thread Jonathan M Davis
On Thursday, March 08, 2012 08:37:38 Comrad wrote: > On Thursday, 8 March 2012 at 06:43:45 UTC, Jonathan M Davis wrote: > > On Wednesday, March 07, 2012 22:40:02 H. S. Teoh wrote: > >> On Thu, Mar 08, 2012 at 07:32:18AM +0100, Comrad wrote: > >> [...] > >> > >> > Basically, I was following Andrei'

Re: Method invocation -- why it's not working?

2012-03-07 Thread Comrad
On Thursday, 8 March 2012 at 06:43:45 UTC, Jonathan M Davis wrote: On Wednesday, March 07, 2012 22:40:02 H. S. Teoh wrote: On Thu, Mar 08, 2012 at 07:32:18AM +0100, Comrad wrote: [...] > Basically, I was following Andrei's book, where this feature > is > described. It's a pity, that it's not w

Re: Raw socket TCP/IP

2012-03-07 Thread dennis luehring
Am 08.02.2012 19:35, schrieb Eyyub: BUMP, I really need help please ! Eyyub. what are you trying to archive? did you got an Ethernet-Frame+IP-Frame+(your replacement for tcp or udp) - or are your trying to change the tcp frame before sending? and if your using Windows: http://msdn.mi

Re: Raw socket TCP/IP

2012-03-07 Thread Tyler Jameson Little
Just curious, but what exactly do you need a raw IP socket for?

Re: Can I do an or in a version block?

2012-03-07 Thread Tyler Jameson Little
Now, you could do version(x) version = xOrY else version(y) version = xOrY version(xOrY) {} Huh, clever! I like it!! I hope I don't have to do that very often, though... Of course, if the issue is linux || FreeBSD, you might want to just consider using Posix. Unless you're doing so

Re: Can I do an or in a version block?

2012-03-07 Thread Tyler Jameson Little
Now, you could do version(x) version = xOrY else version(y) version = xOrY version(xOrY) {} Huh, clever! I like it!! I hope I don't have to do that very often, though... Of course, if the issue is linux || FreeBSD, you might want to just consider using Posix. Unless you're doing so

Re: Method invocation -- why it's not working?

2012-03-07 Thread Jonathan M Davis
On Wednesday, March 07, 2012 22:40:02 H. S. Teoh wrote: > On Thu, Mar 08, 2012 at 07:32:18AM +0100, Comrad wrote: > [...] > > > Basically, I was following Andrei's book, where this feature is > > described. It's a pity, that it's not working (except arrays somehow) > > > > :( - I need it! > > Ye

Re: Method invocation -- why it's not working?

2012-03-07 Thread H. S. Teoh
On Thu, Mar 08, 2012 at 07:32:18AM +0100, Comrad wrote: [...] > Basically, I was following Andrei's book, where this feature is > described. It's a pity, that it's not working (except arrays somehow) > :( - I need it! Yeah there are some features in the book that aren't completely implemented yet.

Re: Method invocation -- why it's not working?

2012-03-07 Thread Comrad
On Thursday, 8 March 2012 at 00:04:55 UTC, Ali Çehreli wrote: On 03/07/2012 03:54 PM, Ali Çehreli wrote: On 03/07/2012 03:21 PM, Comrad wrote: > 1 struct A > 2 { > 3 double[2] _x; > 4 } > 5 > 6 @property ref double y(ref A a) {return a._x[1];} > 7 > 8 void main() > 9 { > 10 A a1; > 11 a1.y=2.; >

Re: Can I do an or in a version block?

2012-03-07 Thread Jonathan M Davis
On Thursday, March 08, 2012 06:38:48 Tyler Jameson Little wrote: > I would like to do something like this: > > version (linux || BSD) { > // do something... > } else { > version (Windows) { > // do something else > } else { > // do something else > assert(

Re: Can I do an or in a version block?

2012-03-07 Thread Ali Çehreli
On 03/07/2012 10:07 PM, James Miller wrote: On 8 March 2012 18:38, Tyler Jameson Little wrote: I would like to do something like this: version (linux || BSD) { // do something... } else { version (Windows) { // do something else } else { // do something else

Re: Can I do an or in a version block?

2012-03-07 Thread James Miller
On 8 March 2012 18:38, Tyler Jameson Little wrote: > I would like to do something like this: > > version (linux || BSD) { >    // do something... > } else { >    version (Windows) { >        // do something else >    } else { >        // do something else >        assert(false, "Unsupported operat

Can I do an or in a version block?

2012-03-07 Thread Tyler Jameson Little
I would like to do something like this: version (linux || BSD) { // do something... } else { version (Windows) { // do something else } else { // do something else assert(false, "Unsupported operating system"); } } The only way I've been able to do this, i

Re: 0 < negative loop condition bug or misunderstanding on my part

2012-03-07 Thread Ali Çehreli
On 03/07/2012 07:51 PM, Ellery Newcomer wrote: On 03/07/2012 12:23 AM, Ali Çehreli wrote: There are probably hundreds of discussions about that over the years on many different language newsgroups and forums. :) There is no clear winner: Both sides of the arguments seem to have good points. Al

Re: 0 < negative loop condition bug or misunderstanding on my part

2012-03-07 Thread Ellery Newcomer
On 03/07/2012 12:23 AM, Ali Çehreli wrote: There are probably hundreds of discussions about that over the years on many different language newsgroups and forums. :) There is no clear winner: Both sides of the arguments seem to have good points. Ali know any good ones off the top of your head

Re: Ddoc: no docs generated for nested structs?

2012-03-07 Thread Jonathan M Davis
On Wednesday, March 07, 2012 16:37:44 H. S. Teoh wrote: > On Wed, Mar 07, 2012 at 03:49:26PM -0800, H. S. Teoh wrote: > > I wrote a whole bunch of documentation for a struct that I later decided > > to transplant inside another struct (because the two are closely > > linked), and now the former str

Re: 0 < negative loop condition bug or misunderstanding on my part

2012-03-07 Thread Jonathan M Davis
On Thursday, March 08, 2012 16:15:08 James Miller wrote: > Its the semantics in C/C++ and D explicitly tries to have the same > semantics as them. From what I remember its to aid people moving from > those language to D. More like it's to avoid code silently breaking when it's ported. In general,

Re: 0 < negative loop condition bug or misunderstanding on my part

2012-03-07 Thread James Miller
On 8 March 2012 15:39, Ary Manzana wrote: > On 3/7/12 2:28 AM, Ali Çehreli wrote: >> >> On 03/06/2012 09:11 PM, ixid wrote: >>  > I'm writing my first basic algorithms, this one is merge sort. This >>  > version throws an exception when array.length - setSize is negative >>  > (which should be fin

Re: 0 < negative loop condition bug or misunderstanding on my part

2012-03-07 Thread Ary Manzana
On 3/7/12 2:28 AM, Ali Çehreli wrote: On 03/06/2012 09:11 PM, ixid wrote: > I'm writing my first basic algorithms, this one is merge sort. This > version throws an exception when array.length - setSize is negative > (which should be fine, the rest of my function would deal with it): > > temp

Re: Ddoc: no docs generated for nested structs?

2012-03-07 Thread H. S. Teoh
On Wed, Mar 07, 2012 at 03:49:26PM -0800, H. S. Teoh wrote: > I wrote a whole bunch of documentation for a struct that I later decided > to transplant inside another struct (because the two are closely > linked), and now the former struct's docs have vanished. Is this > expected behaviour? [...] A

Re: Method invocation -- why it's not working?

2012-03-07 Thread Andrej Mitrovic
Don't worry Ali I thought the same thing. :p

Re: Method invocation -- why it's not working?

2012-03-07 Thread Ali Çehreli
On 03/07/2012 03:54 PM, Ali Çehreli wrote: On 03/07/2012 03:21 PM, Comrad wrote: > 1 struct A > 2 { > 3 double[2] _x; > 4 } > 5 > 6 @property ref double y(ref A a) {return a._x[1];} > 7 > 8 void main() > 9 { > 10 A a1; > 11 a1.y=2.; > 12 } > > dmd test.d gives me: > > Error: no pr

Re: Method invocation -- why it's not working?

2012-03-07 Thread Ali Çehreli
On 03/07/2012 03:21 PM, Comrad wrote: > 1 struct A > 2 { > 3 double[2] _x; > 4 } > 5 > 6 @property ref double y(ref A a) {return a._x[1];} > 7 > 8 void main() > 9 { > 10 A a1; > 11 a1.y=2.; > 12 } > > dmd test.d gives me: > > Error: no property 'y' for type 'A' > > You are testing out the new UFC

Re: Method invocation -- why it's not working?

2012-03-07 Thread Simen Kjærås
On Thu, 08 Mar 2012 00:21:36 +0100, Comrad wrote: 1 struct A 2 { 3 double[2] _x; 4 } 5 6 @property ref double y(ref A a) {return a._x[1];} 7 8 void main() 9 { 10 A a1; 11 a1.y=2.; 12 } dmd test.d gives me: Error: no property 'y' for type 'A' Uniform

Ddoc: no docs generated for nested structs?

2012-03-07 Thread H. S. Teoh
I wrote a whole bunch of documentation for a struct that I later decided to transplant inside another struct (because the two are closely linked), and now the former struct's docs have vanished. Is this expected behaviour? T -- I am a consultant. My job is to make your job redundant. -- Mr Tom

Method invocation -- why it's not working?

2012-03-07 Thread Comrad
1 struct A 2 { 3 double[2] _x; 4 } 5 6 @property ref double y(ref A a) {return a._x[1];} 7 8 void main() 9 { 10 A a1; 11 a1.y=2.; 12 } dmd test.d gives me: Error: no property 'y' for type 'A'

Re: D RTTI?

2012-03-07 Thread Artur Skawina
On 03/07/12 00:19, H. S. Teoh wrote: > On Tue, Mar 06, 2012 at 11:40:19PM +0100, Artur Skawina wrote: >> On 03/06/12 20:37, H. S. Teoh wrote: >>> On Tue, Mar 06, 2012 at 01:51:51AM +0100, Artur Skawina wrote: >>> [...] class A { string prop1; int prop2; void serial

Re: 0 < negative loop condition bug or misunderstanding on my part

2012-03-07 Thread Jonathan M Davis
On Wednesday, March 07, 2012 13:20:41 Sean Cavanaugh wrote: > On 3/7/2012 12:57 PM, Jonathan M Davis wrote: > > On Wednesday, March 07, 2012 11:01:05 Timon Gehr wrote: > >> On 03/07/2012 07:05 AM, ixid wrote: > >>> Ah, thank you, so it's wrapping. That seems like a bad idea, what is the > > > > I

Re: 0 < negative loop condition bug or misunderstanding on my part

2012-03-07 Thread Sean Cavanaugh
On 3/7/2012 12:57 PM, Jonathan M Davis wrote: On Wednesday, March 07, 2012 11:01:05 Timon Gehr wrote: On 03/07/2012 07:05 AM, ixid wrote: Ah, thank you, so it's wrapping. That seems like a bad idea, what is the I suspect that the reality of the matter is that if we disallowed implicit conversi

Re: Why is std.algorithm.reduce impure?

2012-03-07 Thread Jonathan M Davis
On Wednesday, March 07, 2012 17:29:24 Simen Kjærås wrote: > On Wed, 07 Mar 2012 01:41:22 +0100, Jonathan M Davis > > wrote: > > It really takes very little for something to be impure, and optimizations > > often do it, because they end up using low-level constructs which aren't > > pure > > - som

Re: 0 < negative loop condition bug or misunderstanding on my part

2012-03-07 Thread Jonathan M Davis
On Wednesday, March 07, 2012 11:01:05 Timon Gehr wrote: > On 03/07/2012 07:05 AM, ixid wrote: > > Ah, thank you, so it's wrapping. That seems like a bad idea, what is the > > benefit to size being unsigned rather than signed? This case would seem > > like one where allowing negatives is clearly bet

Re: Why is std.algorithm.reduce impure?

2012-03-07 Thread Jonathan M Davis
On Wednesday, March 07, 2012 17:58:43 Timon Gehr wrote: > On 03/07/2012 05:29 PM, Simen Kjærås wrote: > > On Wed, 07 Mar 2012 01:41:22 +0100, Jonathan M Davis > > > > wrote: > >> It really takes very little for something to be impure, and optimizations > >> often do it, because they end up using

Re: SocketStream exceptions and disconnect handling

2012-03-07 Thread Regan Heath
On Wed, 07 Mar 2012 17:29:25 -, Pedro Lacerda wrote: 2012/3/7 Pedro Lacerda Hi all, I'm trying to handle disconnections transparently on SocketStream. I thought something like this: void send(ubyte[] buffer) in { assert(buffer.length > 0); } body { if (!stream.isAlive) connect();

Re: SocketStream exceptions and disconnect handling

2012-03-07 Thread Pedro Lacerda
My english is bugged, I mean "handle reconnections transparently". Sorry. Pedro Lacerda 2012/3/7 Pedro Lacerda > Hi all, > > I'm trying to handle disconnections transparently on SocketStream. I > thought something like this: > > void send(ubyte[] buffer) in { assert(buffer.length > 0); } > bo

SocketStream exceptions and disconnect handling

2012-03-07 Thread Pedro Lacerda
Hi all, I'm trying to handle disconnections transparently on SocketStream. I thought something like this: void send(ubyte[] buffer) in { assert(buffer.length > 0); } body { if (!stream.isAlive) connect(); auto sent = stream.write(buffer); if (sent == 0) throw new Exception("Er

Re: duplicate symbol linker errors, my fault or D's?

2012-03-07 Thread Zach the Mystic
On Tuesday, 6 March 2012 at 07:29:54 UTC, Jacob Carlborg wrote: Actually the -lib switch might be the answer to one of the incremental compilation problems DMD suffers from. That DMD usually does not output all symbols to all object files which can result in missing symbols when doing increment

Re: Why is std.algorithm.reduce impure?

2012-03-07 Thread Timon Gehr
On 03/07/2012 05:29 PM, Simen Kjærås wrote: On Wed, 07 Mar 2012 01:41:22 +0100, Jonathan M Davis wrote: It really takes very little for something to be impure, and optimizations often do it, because they end up using low-level constructs which aren't pure - some of which could be but aren't an

Re: Why is std.algorithm.reduce impure?

2012-03-07 Thread Simen Kjærås
On Wed, 07 Mar 2012 01:41:22 +0100, Jonathan M Davis wrote: It really takes very little for something to be impure, and optimizations often do it, because they end up using low-level constructs which aren't pure - some of which could be but aren't and others which probably can't be. Just

Re: 0 < negative loop condition bug or misunderstanding on my part

2012-03-07 Thread Andrej Mitrovic
On 3/7/12, Timon Gehr wrote: > The problem is not that length is unsigned. The issue is the implicit > conversion from signed to unsigned. You bet. I've once had this hard to spot bug where I've used a call that was something like max(0, min(10, )), and this ended up returning a negative int beca

Re: Raw socket TCP/IP

2012-03-07 Thread maarten van damme
this might be a little late but could it be that the ethernet header was also needed?

Re: 0 < negative loop condition bug or misunderstanding on my part

2012-03-07 Thread Timon Gehr
On 03/07/2012 11:01 AM, Timon Gehr wrote: On 03/07/2012 07:05 AM, ixid wrote: Ah, thank you, so it's wrapping. That seems like a bad idea, what is the benefit to size being unsigned rather than signed? This case would seem like one where allowing negatives is clearly better and more intuitive.

Re: 0 < negative loop condition bug or misunderstanding on my part

2012-03-07 Thread Timon Gehr
On 03/07/2012 07:05 AM, ixid wrote: Ah, thank you, so it's wrapping. That seems like a bad idea, what is the benefit to size being unsigned rather than signed? This case would seem like one where allowing negatives is clearly better and more intuitive. The problem is not that length is unsigned

Re: 0 < negative loop condition bug or misunderstanding on my part

2012-03-07 Thread James Miller
On 7 March 2012 19:30, H. S. Teoh wrote: >> On 03/06/2012 10:05 PM, ixid wrote: >> > Ah, thank you, so it's wrapping. That seems like a bad idea, what is >> > the benefit to size being unsigned rather than signed? >> > This case would seem like one where allowing negatives is clearly >> > better a