Remove dir contents?

2012-04-05 Thread Andrej Mitrovic
There's rmdirRecurse in std.file, but it removes the folder itself as well as its contents. I'm looking for a function that removes only the contents of the dir. Is this in Phobos, and if not can we add it? Otherwise I have to use platform-specific calls to system() like "del *.*".

Re: Remove dir contents?

2012-04-05 Thread Andrej Mitrovic
On 4/5/12, Andrej Mitrovic wrote: > Otherwise I have to use platform-specific calls to system() like "del *.*". Actually nevermind that, I can just remove the dir entirely and then re-create it.

SUL for Posix (was: Read a unicode character from the terminal)

2012-04-05 Thread Stewart Gordon
On 05/04/2012 07:18, Jacob Carlborg wrote: Ok, I see. The functions that need a Posix implementation are mostly in datetime and commandline, if I recall correctly. These are already present in Phobos? Maybe it contains the code I need to finish datetime off. Though I can't really just copy

Re: SUL for Posix

2012-04-05 Thread Jacob Carlborg
On 2012-04-05 12:55, Stewart Gordon wrote: On 05/04/2012 07:18, Jacob Carlborg wrote: Ok, I see. The functions that need a Posix implementation are mostly in datetime and commandline, if I recall correctly. These are already present in Phobos? Maybe it contains the code I need to finish datet

Re: Questions about the slice operator

2012-04-05 Thread Christophe
"Jonathan M Davis" , dans le message (digitalmars.D.learn:34243), a > Except that opSlice already works with "..". What would this buy you? Having a specific range for a .. operator allows you to have them as parameters of any function. For example, this could be nice for multidimensional slicin

Up to date documentation on D implementation.

2012-04-05 Thread ReneSac
Hi. I'm totally new to D, and would like to use it to prototype some compression software ideas. But everywhere in old posts I see that some XYZ feature of the language is buggy, subject to change, etc. But I don't know how it is today, and I would rather not learn what is wrong with the feat

Re: Up to date documentation on D implementation.

2012-04-05 Thread bearophile
ReneSac: My hand will be full with my own bugs, and I would like to suppose an correctly working language... If you use more than the basic C features, you will find DMD compiler bugs (and probably the same is true for any D compiler, because most bugs are in the front-end, that is shared). La

Re: Questions about the slice operator

2012-04-05 Thread Timon Gehr
On 04/04/2012 12:06 PM, Jacob Carlborg wrote: On 2012-04-04 04:11, Jonathan M Davis wrote: foreach(i; 0 .. 5) is more efficient only because it has _nothing_ to do with arrays. Generalizing the syntax wouldn't help at all, and if it were generalized, it would arguably have to be consistent in

Re: Up to date documentation on D implementation.

2012-04-05 Thread David
Am 05.04.2012 17:56, schrieb bearophile: ReneSac: My hand will be full with my own bugs, and I would like to suppose an correctly working language... If you use more than the basic C features, you will find DMD compiler bugs (and probably the same is true for any D compiler, because most bugs

Re: D slower ~1s from C ?!

2012-04-05 Thread q66
On Thursday, 5 April 2012 at 17:22:38 UTC, Minas wrote: Many of you should know the website "projecteuler.net", where there are mathematical problems to solve with computers. I am doing those in D, and after I finished one today, I decided to compile it in C as well to compare the results. T

Re: Remove dir contents?

2012-04-05 Thread Jonathan M Davis
On Thursday, April 05, 2012 12:55:23 Andrej Mitrovic wrote: > On 4/5/12, Andrej Mitrovic wrote: > > Otherwise I have to use platform-specific calls to system() like "del > > *.*". > > Actually nevermind that, I can just remove the dir entirely and then > re-create it. I don't believe that there'

Re: Questions about the slice operator

2012-04-05 Thread Jonathan M Davis
On Thursday, April 05, 2012 14:58:41 Christophe wrote: > "Jonathan M Davis" , dans le message (digitalmars.D.learn:34243), a > > > Except that opSlice already works with "..". What would this buy you? As I said, all it does is give you syntactic sugar for iota which can't even do as much as iota

Re: D slower ~1s from C ?!

2012-04-05 Thread Andrej Mitrovic
On 4/5/12, Minas wrote: > And this is the time execution of the programs C via GCC (gcc -m32 test.c -o testgcc.exe -std=c99 -lm -O5) Elapsed Time: 0:00:02.015 D via DMD (dmd test.d -oftestdmd.exe -release -inline -O -noboundscheck) Elapsed Time: 0:00:08.312 D via GDC (gdmd -m32 -release

Re: Remove dir contents?

2012-04-05 Thread Andrej Mitrovic
On 4/5/12, Jonathan M Davis wrote: > But it does have the downside of > the new directory possibly not matching the original one with regards to > permissions or ownership That's a very good point. Since I run all of my code locally I never run into these issues and so I've never given thought ab

Re: Up to date documentation on D implementation.

2012-04-05 Thread Jesse Phillips
On Thursday, 5 April 2012 at 15:01:53 UTC, ReneSac wrote: Hi. I'm totally new to D, and would like to use it to prototype some compression software ideas. You'll be pretty safe using features you know for C, but you can venture out pretty far from it. While, the page isn't specific to the

Re: Questions about the slice operator

2012-04-05 Thread bearophile
Christophe: > Having a specific range for a .. operator allows you to have them as > parameters of any function. Such functions are also able to accept a Iota struct and then read its fields to find its bounds. For Jonathan M Davis: the first class intervals seem nice to have, but they aren'

Re: Up to date documentation on D implementation.

2012-04-05 Thread ReneSac
On Thursday, 5 April 2012 at 18:34:05 UTC, Jesse Phillips wrote: You'll be pretty safe using features you know for C, but you can venture out pretty far from it. While, the page isn't specific to the questions you have at hand, this does cover much of the current state. Remember, recently i

Re: Up to date documentation on D implementation.

2012-04-05 Thread David
Am 05.04.2012 23:10, schrieb ReneSac: Ok, that page gives some pointers. Seems like I shouldn't use std.stream. So, std.cstream or std.stdio are safe? I also heared that, but actually std.stream works pretty well, especially the EndianStream. So I can recommend you to use it.

Re: Up to date documentation on D implementation.

2012-04-05 Thread Jesse Phillips
On Thursday, 5 April 2012 at 21:10:41 UTC, ReneSac wrote: I will probably program close to C/Lua style (the languages I'm most proficient with), but "pretty far" is vague. And I haven't been following the time line of the feature additions, like old users do, and I'm not sure if I should read

Re: Up to date documentation on D implementation.

2012-04-05 Thread ReneSac
On Thursday, 5 April 2012 at 22:07:05 UTC, Jesse Phillips wrote: On Thursday, 5 April 2012 at 21:10:41 UTC, ReneSac wrote: I will probably program close to C/Lua style (the languages I'm most proficient with), but "pretty far" is vague. And I haven't been following the time line of the feature

Re: Up to date documentation on D implementation.

2012-04-05 Thread H. S. Teoh
On Fri, Apr 06, 2012 at 12:42:57AM +0200, ReneSac wrote: > On Thursday, 5 April 2012 at 22:07:05 UTC, Jesse Phillips wrote: [...] > Anyway, GDC seems to have quite better performance/optimization, so > I may end up using it... But I also heard bad things about it in old > posts... so... I use GDC

Re: Up to date documentation on D implementation.

2012-04-05 Thread Jonathan M Davis
On Friday, April 06, 2012 00:07:03 Jesse Phillips wrote: > Hmm, bring up a good point, I think someone is working on > revamping stdio, though I would think it would mostly remain > compatible. Who's doing that? Could you write the details here: It's Steven Schveighoffer, but it's far from ready,

Re: Up to date documentation on D implementation.

2012-04-05 Thread Jonathan M Davis
On Thursday, April 05, 2012 23:47:52 David wrote: > Am 05.04.2012 23:10, schrieb ReneSac: > > Ok, that page gives some pointers. Seems like I shouldn't use > > std.stream. So, std.cstream or std.stdio are safe? > > I also heared that, but actually std.stream works pretty well, > especially the End

Re: D slower ~1s from C ?!

2012-04-05 Thread Kapps
On Thursday, 5 April 2012 at 17:22:38 UTC, Minas wrote: Many of you should know the website "projecteuler.net", where there are mathematical problems to solve with computers. I am doing those in D, and after I finished one today, I decided to compile it in C as well to compare the results. T

Re: Up to date documentation on D implementation.

2012-04-05 Thread Mike Parker
On 4/6/2012 7:42 AM, ReneSac wrote: Most people use DMD, but GDC, I hear, should be on par. I don't need a 64bit binary right now. Actually, I would even prefer a 32bit one for development because then I can't run too wild in memory usage. The problem is that DMD seems to require 32 bit window

Re: Insert an element into an Associative Array ?

2012-04-05 Thread Ary Manzana
On 4/5/12 2:57 AM, Chris Pons wrote: I'm playing around with associative arrays right now and I can't seem to figure out how to add additional objects to the array. I tried insert but it doesn't recognize both arguments. Also, if I do this it produces an error: Node[bool] test; Node node; Nod

Re: Insert an element into an Associative Array ?

2012-04-05 Thread Jonathan M Davis
On Friday, April 06, 2012 11:46:24 Ary Manzana wrote: > By the way, why is it called "associative array"? A name like Hash or > Map would be much better. Everyone knows what a Hash means. I don't see > anyone using "associative array" to refer to a Hash. And I think this is > the source of the conf