Re: Generic collection/element function signatures in D2 versus D1

2010-09-05 Thread BLS
On 05/09/2010 02:16, Jonathan M Davis wrote: void foo(T)(T[] collection, T elem) { // Blah, whatever } I am curious, how this will look and feel once inout is working ? inout void foo(T)(inout(T)[] collection, inout T elem) { // Blah, whatever} }

Re: Synchronized methods in D2

2010-09-05 Thread Jacob Carlborg
On 2010-09-05 02:18, Jonathan M Davis wrote: On Saturday 04 September 2010 12:06:23 Era Scarecrow wrote: I'm currently porting a D1 code base to D2 which has the following class hierarchy: interface Map { void clear (); } class Hashtable : Map { synchronized void clear () {}; }

Re: Synchronized methods in D2

2010-09-05 Thread Jacob Carlborg
On 2010-09-04 21:06, Era Scarecrow wrote: I'm currently porting a D1 code base to D2 which has the following class hierarchy: interface Map { void clear (); } class Hashtable : Map { synchronized void clear () {}; } class HashMap : Map { void clear () {}; } When I compiler

Re: Synchronized methods in D2

2010-09-05 Thread bearophile
Jonathan M Davis: Also, according to TDPL, either your _entire class_ is synchronized, or none of it is. So, synchronized really belongs on the class, not the function, and I wouldn't expect it to compile if only a portion of your functions are synchronized (though I don't know how close

Re: Synchronized methods in D2

2010-09-05 Thread Era Scarecrow
Jonathan M Davis: Also, according to TDPL, either your _entire class_ is synchronized, or none of it is. So, synchronized really belongs on the class, not the function, and I wouldn't expect it to compile if only a portion of your functions are synchronized (though I don't know how

forks/pipes and std.socket

2010-09-05 Thread Nick Sabalausky
This may be a stupid question: Does std.socket encorporate or replace pipe usage? Ie, if I'm going to do something along the lines of (psuedo-code): auto parentToChild = pipe(); auto childToParent = pipe(); if(fork()) { // talk to other process } else { // talk to other process } Is

Fast temporary dynamic arrays? (And slicing of them)

2010-09-05 Thread Tom Kazimiers
Hi all, so I have started to look at D and dug through the documentation, but could not get a good answer on the following: How can I have a (temporary) dynamic array on stack and make references to it (no copying)? I successively put integers in an array (but don't know how much there will be

Re: Fast temporary dynamic arrays? (And slicing of them)

2010-09-05 Thread bearophile
Tom Kazimiers: How can I have a (temporary) dynamic array on stack and make references to it (no copying)? I successively put integers in an array (but don't know how much there will be in advance) with an appender!(int[]) and get the date out with appender.data(). Later on I pass the result

Re: Fast temporary dynamic arrays? (And slicing of them)

2010-09-05 Thread Jonathan M Davis
On Sunday 05 September 2010 18:02:29 Tom Kazimiers wrote: Hi all, so I have started to look at D and dug through the documentation, but could not get a good answer on the following: How can I have a (temporary) dynamic array on stack and make references to it (no copying)? I successively

Re: Fast temporary dynamic arrays? (And slicing of them)

2010-09-05 Thread bearophile
My first test shows that it may work. But I have to grow the array backwards, and push back the array start, because that's how my stack grows (using alloca to allocate geometrically bigger chunks). So unless you want to reverse the items once the array is built, you have to change the