Re: CMake for D

2012-02-13 Thread Gour
On Tue, 14 Feb 2012 01:37:20 +0100 bioinfornatics wrote: > Maybe send a pull request to main cmake repo will be better. It is > always better to put code to upstream I did ask in the mailing list (sometime ago) about the procedure to include it to upstream, but got no replies and then have becom

Re: Named character entities

2012-02-13 Thread Ali Çehreli
On 02/13/2012 09:46 PM, H. S. Teoh wrote: > What is the correct format for named character entities? According to > the online specs, I should be able to write: > >dchar ch = '&'; > > But gdc-4.6.2 refuses to compile this; apparently it wants: > >dchar ch = '\&'; > > Which is right?? > > >

Named character entities

2012-02-13 Thread H. S. Teoh
What is the correct format for named character entities? According to the online specs, I should be able to write: dchar ch = '&'; But gdc-4.6.2 refuses to compile this; apparently it wants: dchar ch = '\&'; Which is right?? T -- People say I'm indecisive, but I'm not sure a

Chatting with a server

2012-02-13 Thread Pedro Lacerda
How would you chat with a server? This is my naive attempt: class Client { Socket socket; Token fetch() { ubyte[1024] buffer; // if more space is needed... socket.receive(buffer); return decode(buffer); } void send(Token tkn) { ubyte[] buffer = encode(tkn); socket.s

Re: Arrays - Inserting and moving data

2012-02-13 Thread Timon Gehr
On 02/14/2012 12:34 AM, James Miller wrote: On 14 February 2012 06:25, Timon Gehr wrote: On 02/13/2012 03:19 PM, James Miller wrote: On 11 February 2012 10:45, Jonathan M Daviswrote: On Friday, February 10, 2012 13:32:56 Marco Leise wrote: I know that feeling. I had no exposure to fun

Re: CMake for D

2012-02-13 Thread bioinfornatics
Le lundi 13 février 2012 à 20:45 +0100, Gour a écrit : > On Mon, 13 Feb 2012 12:15:23 -0700 > Kai Meyer wrote: > > > Both are quite old. Can anybody comment on the usability of either of > > these projects? Or perhaps point me to another project that will work? > > Try with newer: http://code.g

Re: Instance-specific unittests

2012-02-13 Thread H. S. Teoh
On Mon, Feb 13, 2012 at 07:15:18PM -0500, Steven Schveighoffer wrote: [...] > 3. If you are making classes like this, make *sure* all your unit > test helper functions are non-virtual! Otherwise, if some code > instantiates with unit tests on and some off, you will have vtable > inconsistencies. [

Re: Instance-specific unittests

2012-02-13 Thread Steven Schveighoffer
On Mon, 13 Feb 2012 18:12:15 -0500, H. S. Teoh wrote: I discovered something really cool today, and I thought I'd share it with my fellow learners: The unittest block is used for inserting unit tests that are executed at runtime before main() is called. They are very useful for inserting lit

Re: Instance-specific unittests

2012-02-13 Thread H. S. Teoh
On Tue, Feb 14, 2012 at 12:40:13PM +1300, James Miller wrote: [...] > Its pretty cool, I didn't think about it, but it makes sense, since > the compiler essentially makes a new version of the code for each > instantiation. > > Also I imagine that common-to-all tests should probably be done inside

Re: Arrays - Inserting and moving data

2012-02-13 Thread Jonathan M Davis
On Tuesday, February 14, 2012 13:02:43 James Miller wrote: > On 14 February 2012 12:45, Ali Çehreli wrote: > > On 02/13/2012 03:34 PM, James Miller wrote: > >> Saying "it is not quicksort as much as it may conceptually resemble > >> quicksort" is kinda odd, its like saying "it is not a car, as muc

Re: Arrays - Inserting and moving data

2012-02-13 Thread James Miller
On 14 February 2012 12:45, Ali Çehreli wrote: > On 02/13/2012 03:34 PM, James Miller wrote: > >> Saying "it is not quicksort as much as it may conceptually resemble >> quicksort" is kinda odd, its like saying "it is not a car, as much as >> it may conceptually resemble a car" because it doesn't ru

Re: Arrays - Inserting and moving data

2012-02-13 Thread Ali Çehreli
On 02/13/2012 03:34 PM, James Miller wrote: > Saying "it is not quicksort as much as it may conceptually resemble > quicksort" is kinda odd, its like saying "it is not a car, as much as > it may conceptually resemble a car" because it doesn't run on petrol > or gas, but instead runs on environmen

Re: Instance-specific unittests

2012-02-13 Thread James Miller
On 14 February 2012 12:26, Jonathan M Davis wrote: > On Monday, February 13, 2012 15:12:15 H. S. Teoh wrote: >> I discovered something really cool today, and I thought I'd share it >> with my fellow learners: >> >> The unittest block is used for inserting unit tests that are executed at >> runtime

Re: Arrays - Inserting and moving data

2012-02-13 Thread James Miller
On 14 February 2012 06:25, Timon Gehr wrote: > On 02/13/2012 03:19 PM, James Miller wrote: >> >> On 11 February 2012 10:45, Jonathan M Davis  wrote: >>> >>> On Friday, February 10, 2012 13:32:56 Marco Leise wrote: >>> I know that feeling. I had no exposure to functional programming and o

Re: Instance-specific unittests

2012-02-13 Thread Jonathan M Davis
On Monday, February 13, 2012 15:12:15 H. S. Teoh wrote: > I discovered something really cool today, and I thought I'd share it > with my fellow learners: > > The unittest block is used for inserting unit tests that are executed at > runtime before main() is called. They are very useful for inserti

Instance-specific unittests

2012-02-13 Thread H. S. Teoh
I discovered something really cool today, and I thought I'd share it with my fellow learners: The unittest block is used for inserting unit tests that are executed at runtime before main() is called. They are very useful for inserting little tests after a piece of complex code, to make sure it act

Re: Stride

2012-02-13 Thread Artur Skawina
On 02/13/12 23:39, Timon Gehr wrote: > On 02/13/2012 11:27 PM, Artur Skawina wrote: >> On 02/13/12 22:58, Jonathan M Davis wrote: >>> On Monday, February 13, 2012 22:24:38 Artur Skawina wrote: The important thing here is - the order absolutely *must* be foo(), then bar(), what happens und

Re: Stride

2012-02-13 Thread Jonathan M Davis
On Monday, February 13, 2012 23:27:37 Artur Skawina wrote: > I'm not arguing that it _should_ be defined - just pointing out that the > fact that it currently _is_ means one should be able to assume it works. > After all there's only one D frontend and it comes from the vendor that > also effective

Re: Stride

2012-02-13 Thread Timon Gehr
On 02/13/2012 11:27 PM, Artur Skawina wrote: On 02/13/12 22:58, Jonathan M Davis wrote: On Monday, February 13, 2012 22:24:38 Artur Skawina wrote: The important thing here is - the order absolutely *must* be foo(), then bar(), what happens under the hood is completely irrelevant. The reason is

Re: Stride

2012-02-13 Thread Artur Skawina
On 02/13/12 22:58, Jonathan M Davis wrote: > On Monday, February 13, 2012 22:24:38 Artur Skawina wrote: >> The important thing here is - the order absolutely *must* be foo(), then >> bar(), what happens under the hood is completely irrelevant. The reason is >> simple - if this is not what happens t

Re: Templated aliases name in compilation error output

2012-02-13 Thread Jonathan M Davis
On Monday, February 13, 2012 19:59:40 Pedro Lacerda wrote: > Would be bad or hard dmd keep those information, and outputs like gcc "aka"? It should be quite possible, but I have no idea how hard it would be. Regardless, it's not the kind of change I'd expect anytime soon, because the benefits ar

Re: Templated aliases name in compilation error output

2012-02-13 Thread Pedro Lacerda
Would be bad or hard dmd keep those information, and outputs like gcc "aka"? Pedro Lacerda 2012/2/12 Jonathan M Davis > On Sunday, February 12, 2012 13:00:16 Trass3r wrote: > > dmd simply doesn't keep those information about aliases. > > Exactly. > > - Jonathan M Davis >

Re: Stride

2012-02-13 Thread Jonathan M Davis
On Monday, February 13, 2012 22:24:38 Artur Skawina wrote: > The important thing here is - the order absolutely *must* be foo(), then > bar(), what happens under the hood is completely irrelevant. The reason is > simple - if this is not what happens then it's a serious compiler bug. And > if you ca

Re: Stride

2012-02-13 Thread Artur Skawina
On 02/13/12 21:52, Jonathan M Davis wrote: > On Monday, February 13, 2012 21:49:05 Artur Skawina wrote: >> "argument evaluation" in this context means that given eg "f(a,b,c);" >> it's not specified in what order the expressions 'a', 'b', and 'c' >> are evaluated, which matters if they are dependen

Re: Stride

2012-02-13 Thread Jonathan M Davis
On Monday, February 13, 2012 21:49:05 Artur Skawina wrote: > "argument evaluation" in this context means that given eg "f(a,b,c);" > it's not specified in what order the expressions 'a', 'b', and 'c' > are evaluated, which matters if they are dependent or have side > effects. (depending on arg pass

Re: maketrans and translate

2012-02-13 Thread Jonathan M Davis
On Monday, February 13, 2012 14:08:16 bearophile wrote: > Jonathan M Davis: > > Do you have data to backup that there is a significant speed difference? > > I have just written a small benchmark, it contains both the URL to the test > data and the timings I am seeing on a slow PC. If your PC is fa

Re: Stride

2012-02-13 Thread Artur Skawina
On 02/13/12 20:47, Jonathan M Davis wrote: > On Monday, February 13, 2012 19:47:03 Artur Skawina wrote: >> On 02/13/12 18:57, Jonathan M Davis wrote: >>> On Sunday, February 12, 2012 10:07:52 Ali Çehreli wrote: Related question: Does D define the order of evaluation in an expression

Re: CMake for D

2012-02-13 Thread Gour
On Mon, 13 Feb 2012 12:15:23 -0700 Kai Meyer wrote: > Both are quite old. Can anybody comment on the usability of either of > these projects? Or perhaps point me to another project that will work? Try with newer: http://code.google.com/p/cmaked2/ Sincerely, Gour -- The working senses are su

Re: Stride

2012-02-13 Thread Jonathan M Davis
On Monday, February 13, 2012 19:47:03 Artur Skawina wrote: > On 02/13/12 18:57, Jonathan M Davis wrote: > > On Sunday, February 12, 2012 10:07:52 Ali Çehreli wrote: > >> Related question: Does D define the order of evaluation in an > >> expression > >> like > >> > >> foo() ~ bar() > >> > >> Or is

CMake for D

2012-02-13 Thread Kai Meyer
I have some D code that I would like to integrate into an existing CMake infrastructure. I've seen these two projects: http://www.dsource.org/projects/cmaked http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/cmake/modules/language_support/cmake/Platform/ Both are quite old. Can anybody comme

Re: maketrans and translate

2012-02-13 Thread bearophile
Jonathan M Davis: > Do you have data to backup that there is a significant speed difference? I have just written a small benchmark, it contains both the URL to the test data and the timings I am seeing on a slow PC. If your PC is faster feel free to use it on more data (creating a larger input

Re: Stride

2012-02-13 Thread Artur Skawina
On 02/13/12 18:57, Jonathan M Davis wrote: > On Sunday, February 12, 2012 10:07:52 Ali Çehreli wrote: >> Related question: Does D define the order of evaluation in an expression >> like >> >> foo() ~ bar() >> >> Or is it unspecified as in C and C++? > > It's currently unspecified. Walter has state

Re: Stride

2012-02-13 Thread Jonathan M Davis
On Sunday, February 12, 2012 10:07:52 Ali Çehreli wrote: > Related question: Does D define the order of evaluation in an expression > like > > foo() ~ bar() > > Or is it unspecified as in C and C++? It's currently unspecified. Walter has stated that he wants to make it so that it's always left

Re: maketrans and translate

2012-02-13 Thread Jonathan M Davis
On Monday, February 13, 2012 08:09:06 bearophile wrote: > Stewart Gordon: > > Use an associative array for the translation table. > > A new version of the code: > > import std.stdio, std.string, std.range; > void main() { > char[] text = "dssdadsdasdas".dup; // lots of MBs of pure 7 bit ASCII > t

Re: Arrays - Inserting and moving data

2012-02-13 Thread Timon Gehr
On 02/13/2012 03:19 PM, James Miller wrote: On 11 February 2012 10:45, Jonathan M Davis wrote: On Friday, February 10, 2012 13:32:56 Marco Leise wrote: I know that feeling. I had no exposure to functional programming and options like chain never come to my head. Although "map" is a concept tha

Re: shifting array slices

2012-02-13 Thread Steven Schveighoffer
On Sat, 11 Feb 2012 14:24:53 -0500, H. S. Teoh wrote: On Sat, Feb 11, 2012 at 11:02:43AM -0800, Jonathan M Davis wrote: On Saturday, February 11, 2012 10:51:36 H. S. Teoh wrote: > This brings up an interesting point: what does the GC do if you have an > array that's continually appended t

Re: toString multiple overrides

2012-02-13 Thread Steven Schveighoffer
On Sat, 11 Feb 2012 08:56:01 -0500, Timon Gehr wrote: On 02/11/2012 08:48 AM, Jonathan M Davis wrote: On Friday, February 10, 2012 22:41:20 Ellery Newcomer wrote: dmd 2.057 Two mixin templates, each define toString, mix them in to your class and .. Error: function test.X.T2!().toString m

Re: Arrays - Inserting and moving data

2012-02-13 Thread James Miller
On 11 February 2012 10:45, Jonathan M Davis wrote: > On Friday, February 10, 2012 13:32:56 Marco Leise wrote: >> I know that feeling. I had no exposure to functional programming and >> options like chain never come to my head. Although "map" is a concept that >> I made friends with early. > > It w

Re: maketrans and translate

2012-02-13 Thread bearophile
Stewart Gordon: > Use an associative array for the translation table. A new version of the code: import std.stdio, std.string, std.range; void main() { char[] text = "dssdadsdasdas".dup; // lots of MBs of pure 7 bit ASCII text dchar[dchar] aa = ['A':'5', 'a':'5', 'B':'7', 'b':'7', 'C':'6

Re: maketrans and translate

2012-02-13 Thread Stewart Gordon
On 13/02/2012 03:04, bearophile wrote: In the online docs I've seen that std.string.maketrans() is (going to be) deprecated. How do you adapt this code to the new regime? Use an associative array for the translation table. Or write your own functions that work in the same way as maketrans/tr