Re: templates

2010-04-20 Thread Philippe Sigaud
On Mon, Apr 19, 2010 at 22:58, Steven Schveighoffer schvei...@yahoo.comwrote: I'm not used to using interfaces in this way. What become the stored T values when you cast the classes into IW to construct your array? I suppose they're lost? Not sure what you mean... What if the class has

Re: templates

2010-04-20 Thread Steven Schveighoffer
On Tue, 20 Apr 2010 02:01:23 -0400, Philippe Sigaud philippe.sig...@gmail.com wrote: On Mon, Apr 19, 2010 at 22:58, Steven Schveighoffer schvei...@yahoo.comwrote: I'm not used to using interfaces in this way. What become the stored T values when you cast the classes into IW to construct

Re: ctfe library

2010-04-20 Thread Ary Borenszweig
Ellery Newcomer wrote: Are there any good libraries for ctfe/code generation? I don't know, things like parsing support for compile time strings, string formatting, type - string My project seems to be growing ctfe, and it's all horribly hacky and ugly code. I think all ctfe code is

Re: ctfe library

2010-04-20 Thread Ary Borenszweig
Ellery Newcomer wrote: Are there any good libraries for ctfe/code generation? I don't know, things like parsing support for compile time strings, string formatting, type - string My project seems to be growing ctfe, and it's all horribly hacky and ugly code. I think all ctfe code is

Re: Code speed and C++

2010-04-20 Thread Joseph Wakeling
bearophile wrote: Joseph Wakeling: I took a little time last night and wrote up a C++ version that I'll take a look at this, I was away for few days. Thank you very much! No rush or even necessity -- I'm just curious if it sheds any light on D-related issues. :-)

Re: Newsgroups, off-topic

2010-04-20 Thread Don
Jérôme M. Berger wrote: Simen kjaeraas wrote: Joseph Wakeling joseph.wakel...@webdrake.net wrote: Maybe true, but I was thinking of it from a different angle -- why the main D2 development does not switch backends. So which do you suggest be used instead - the one that doesn't work on

Re: ctfe library

2010-04-20 Thread Don
Ellery Newcomer wrote: Are there any good libraries for ctfe/code generation? I don't know, things like parsing support for compile time strings, string formatting, type - string My project seems to be growing ctfe, and it's all horribly hacky and ugly code. I've found that the function

Re: Newsgroups, off-topic

2010-04-20 Thread Steven Schveighoffer
On Tue, 20 Apr 2010 10:50:37 -0400, Don nos...@nospam.com wrote: Jérôme M. Berger wrote: Simen kjaeraas wrote: Joseph Wakeling joseph.wakel...@webdrake.net wrote: Maybe true, but I was thinking of it from a different angle -- why the main D2 development does not switch backends. So which

Re: ctfe library

2010-04-20 Thread Don
Ary Borenszweig wrote: Ellery Newcomer wrote: Are there any good libraries for ctfe/code generation? I don't know, things like parsing support for compile time strings, string formatting, type - string My project seems to be growing ctfe, and it's all horribly hacky and ugly code. I

Re: ctfe library

2010-04-20 Thread Ellery Newcomer
On 04/20/2010 10:17 AM, Don wrote: I don't see anything particularly ugly or hacky about CTFE code, like the code below: int greater(int a, int b) { if (ab) return a; else return b; } int [ greater(short.max/3, 515) ] foo; It isn't. Things don't get ugly until you hit the relatively low

Re: ctfe library

2010-04-20 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ellery Newcomer wrote: As ctfe support matures, I dream of a full-fledged parser generator that can be evaluated at compile time, although that's way more heavy duty than what most people will need. My spirit port might be an option at some

Re: ctfe library

2010-04-20 Thread Ellery Newcomer
On 04/20/2010 01:02 PM, div0 wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ellery Newcomer wrote: As ctfe support matures, I dream of a full-fledged parser generator that can be evaluated at compile time, although that's way more heavy duty than what most people will need. My spirit

Re: ctfe library

2010-04-20 Thread Don
Ellery Newcomer wrote: On 04/20/2010 10:17 AM, Don wrote: I don't see anything particularly ugly or hacky about CTFE code, like the code below: int greater(int a, int b) { if (ab) return a; else return b; } int [ greater(short.max/3, 515) ] foo; It isn't. Things don't get ugly until you

Re: ctfe library

2010-04-20 Thread bearophile
Don: I've found that the function below improves things immensely. I might propose it for std.metastrings in the next Phobos release. Can you tell me what this function can be useful for? Thank you, bye, bearophile

Comb Sort with ranges

2010-04-20 Thread bearophile
As exercise to learn D2 ranges usage I've translated to D2 the C++ version of the Comb sort: http://en.wikipedia.org/wiki/Comb_sort#C.2B.2B_Implementation It wasn't easy, but on those tests it works! Do you see errors or things that can be improved in this D2 code? I have verified that the

Re: Comb Sort with ranges

2010-04-20 Thread Ellery Newcomer
this is a bit off topic, but have you noticed that comb sort can consistantly beat the pants off phobos' built in sort for data of reasonable sizes? Admittedly, I didn't implement it using ranges (It's really cool that you can!) and just used arrays.