Re: std.string.chomp error

2010-08-10 Thread Lars T. Kyllingstad
On Mon, 09 Aug 2010 17:35:56 -0700, Jonathan M Davis wrote: On Monday, August 09, 2010 17:09:03 simendsjo wrote: On 10.08.2010 02:09, Jonathan M Davis wrote: On Monday, August 09, 2010 16:59:07 bearophile wrote: simendsjo: Ahem.. :) Yes, I did miss your answer! How I got fooled by the

Re: std.string.chomp error

2010-08-10 Thread Jonathan M Davis
On Tuesday 10 August 2010 00:30:37 Lars T. Kyllingstad wrote: No, using 'is' won't work. Check this out: int[] a; assert (a == null); assert (a is null); a = new int[10]; a.length = 0; assert (a == null); assert (a !is null); The thing is, '==' tests whether two

Re: std.string.chomp error

2010-08-10 Thread Lars T. Kyllingstad
On Tue, 10 Aug 2010 01:48:17 -0700, Jonathan M Davis wrote: On Tuesday 10 August 2010 00:30:37 Lars T. Kyllingstad wrote: No, using 'is' won't work. Check this out: int[] a; assert (a == null); assert (a is null); a = new int[10]; a.length = 0; assert (a == null);

Re: More constants in std.string?

2010-08-10 Thread bearophile
simendsjo: Why a runtime error when you can have a compile time error? Because using the static type system has various kinds of costs that some people in some situations are not willing to pay. Bye, bearophile

Re: [OT] What is more readable?

2010-08-10 Thread bearophile
simendsjo: And on the other hand; I doubt anything of what I write will ever get into phobos! If you exercise writing D code for few months you will be able contribute to Phobos2. Bye, bearophile

Re: [OT] Is this more readable, or just way too verbose?

2010-08-10 Thread simendsjo
Lutger wrote: simendsjo wrote: (...) The CR and LF constants are a bit too much, probably because they don't really abstract over the literals which I can actually parse faster. The isCR and isLF are nice however. Taking it a step further: bool canSplit = inPattern(c,\r\n); if (canSplit)

Re: std.string.chomp error

2010-08-10 Thread bearophile
Lars T. Kyllingstad: There, I don't agree with you. Arrays are a sort of pseudo-reference type, so I don't mind 'null' being a sort of pseudo-null in that context. Actually, I find it to be quite elegant. It's a matter of taste, I guess. I suggest you to write down the things you don't

Re: std.string.chomp error

2010-08-10 Thread Lars T. Kyllingstad
On Tue, 10 Aug 2010 07:50:34 -0400, bearophile wrote: Lars T. Kyllingstad: There, I don't agree with you. Arrays are a sort of pseudo-reference type, so I don't mind 'null' being a sort of pseudo-null in that context. Actually, I find it to be quite elegant. It's a matter of taste, I

Re: std.string.chomp error

2010-08-10 Thread bearophile
Lars T. Kyllingstad: I like how it is designed now, that was my point. Sorry, I misread you.

Re: What is the term for a function that can be CTFEed?

2010-08-10 Thread BCS
Hello Jonathan, On Monday 09 August 2010 21:18:42 BCS wrote: We have pure functions, member functions, static functions and global functions; but what kind of function can always be used with CTFE? Haven't we typical called them CTFE or CTFEable functions? I've seen the first used, even

Shifting values within an array

2010-08-10 Thread Chris Williams
I would like to be able to do something like this: class A { int i; } int main() { A[] list; for (uint L = 0; L 3; L++) { for (uint L2 = 0; L2 3; L2++) { uint index = L + L2; uint copyAmount = list.length

Re: Shifting values within an array

2010-08-10 Thread Steven Schveighoffer
On Tue, 10 Aug 2010 09:01:28 -0400, Chris Williams a...@seanet.com wrote: I would like to be able to do something like this: class A { int i; } int main() { A[] list; for (uint L = 0; L 3; L++) { for (uint L2 = 0; L2 3; L2++) {

Re: Casting away const

2010-08-10 Thread Steven Schveighoffer
On Mon, 09 Aug 2010 19:35:38 -0400, Jonathan M Davis jmdavisp...@gmail.com wrote: On Monday, August 09, 2010 15:01:28 Steven Schveighoffer wrote: Then the author failed to make it const, and it's a bug in the function definition. Casting away const if you don't write is crap, and should be

Re: std.string.chomp error

2010-08-10 Thread Jonathan M Davis
On Tuesday 10 August 2010 02:34:33 Lars T. Kyllingstad wrote: I guess it depends on what behaviour you're after. In the present case, if you want chomp(a, null) and chomp(a, ) to do the same thing, then you should use '=='. If you want chomp(a, ) to simply do nothing, use 'is'. I just

Is there a queue class in phobos?

2010-08-10 Thread Trass3r
Container has List, BinaryHeap etc. but no Queue. Is there anything like that in Phobos?

std.getopt in 2.047

2010-08-10 Thread Stanislav Blinov
Hello, I've noticed that documentation does not reflect what std.getopt does concerning endOfOptions (--). Documentation: Options Terminator A lonesome double-dash terminates getopt gathering. It is used to separate program options from other parameters (e.g. options to be passed to

Re: Is there a queue class in phobos?

2010-08-10 Thread Jonathan M Davis
On Tuesday, August 10, 2010 09:22:16 Trass3r wrote: Container has List, BinaryHeap etc. but no Queue. Is there anything like that in Phobos? At the moment, I believe that what you see is what you get. std.container is quite young, and there are definitely going to be more containers in it, but

Re: What is the term for a function that can be CTFEed?

2010-08-10 Thread div0
On 10/08/2010 13:59, BCS wrote: Hello Jonathan, On Monday 09 August 2010 21:18:42 BCS wrote: We have pure functions, member functions, static functions and global functions; but what kind of function can always be used with CTFE? Haven't we typical called them CTFE or CTFEable functions?

Re: DirectX 11 bindings?

2010-08-10 Thread div0
On 09/08/2010 23:12, Trass3r wrote: No one? Eugh. Nope got OpenGL 3 bindings though. -- My enormous talent is exceeded only by my outrageous laziness. http://www.ssTk.co.uk

Sharing unlocked, unchanging data between threads?

2010-08-10 Thread Chris Williams
I'm writing a fairly large, multithreaded application and some part of it is causing periodic access errors. Say that I have an associative array like: uint[ char[] ] nameToId; If I set all values before I start my threads going and never change anything after that point -- all access is read

Re: Sharing unlocked, unchanging data between threads?

2010-08-10 Thread Steven Schveighoffer
On Tue, 10 Aug 2010 13:45:03 -0400, Chris Williams a...@seanet.com wrote: I'm writing a fairly large, multithreaded application and some part of it is causing periodic access errors. Say that I have an associative array like: uint[ char[] ] nameToId; If I set all values before I start my

Re: [OT] Is this more readable, or just way too verbose?

2010-08-10 Thread Lutger
simendsjo wrote: Lutger wrote: ... I didn't increase the if nesting though. I count 2 nested if-statements inside of the foreach loop in the original, you have 3 nested if-statements. Something like this then? Looks good to me, yes.

Re: Sharing unlocked, unchanging data between threads?

2010-08-10 Thread Jonathan M Davis
On Tuesday, August 10, 2010 10:45:03 Chris Williams wrote: I'm writing a fairly large, multithreaded application and some part of it is causing periodic access errors. Say that I have an associative array like: uint[ char[] ] nameToId; If I set all values before I start my threads going

Re: Sharing unlocked, unchanging data between threads?

2010-08-10 Thread awishformore
On 10/08/2010 20:01, Steven Schveighoffer wrote: On Tue, 10 Aug 2010 13:45:03 -0400, Chris Williams a...@seanet.com wrote: I'm writing a fairly large, multithreaded application and some part of it is causing periodic access errors. Say that I have an associative array like: uint[ char[] ]

Re: Is there a queue class in phobos?

2010-08-10 Thread Jacob Carlborg
On 2010-08-10 18:22, Trass3r wrote: Container has List, BinaryHeap etc. but no Queue. Is there anything like that in Phobos? Wouldn't a regular array with a couple of free functions work? -- /Jacob Carlborg

Re: Sharing unlocked, unchanging data between threads?

2010-08-10 Thread Chris Williams
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article Well, unless it's declared shared, it's going to be thread-local, and then each thread is going to have their own copy. Now, if it were declared shared and you never changed it after initially setting all of its values, then you

Re: Sharing unlocked, unchanging data between threads?

2010-08-10 Thread Jacob Carlborg
On 2010-08-10 20:40, Jonathan M Davis wrote: On Tuesday, August 10, 2010 10:45:03 Chris Williams wrote: I'm writing a fairly large, multithreaded application and some part of it is causing periodic access errors. Say that I have an associative array like: uint[ char[] ] nameToId; If I set

Re: Is there a queue class in phobos?

2010-08-10 Thread Mafi
Am 10.08.2010 18:22, schrieb Trass3r: Container has List, BinaryHeap etc. but no Queue. Is there anything like that in Phobos? Hi, I don't know if ther is one but I think D's arrays are powerful enough unless you avoid the GC. 1. a.front() = a[0] 2. a.popFront() = a = a[1..$] 3.

Re: dsss build, tango, GC ?

2010-08-10 Thread Fred Burton
Still having that apparent GC problem (with Tango on my machine), does anyone have (some GC test code) that they can recommend that I run so that I can confirm that my GC is / is not working?

Re: Is there a queue class in phobos?

2010-08-10 Thread Jonathan M Davis
On Tuesday, August 10, 2010 12:06:55 Mafi wrote: Am 10.08.2010 18:22, schrieb Trass3r: Container has List, BinaryHeap etc. but no Queue. Is there anything like that in Phobos? Hi, I don't know if ther is one but I think D's arrays are powerful enough unless you avoid the GC. 1.

Re: Sharing unlocked, unchanging data between threads?

2010-08-10 Thread Jonathan M Davis
On Tuesday, August 10, 2010 11:54:06 Jacob Carlborg wrote: I though immutable was supposed to be implicitly shared with no need for locks or read-write barriers (or what they're called). Ah. I have no clue that D1 does. I only use D2. There's obviously nothing wrong with posting D1 questions

Re: Is there a queue class in phobos?

2010-08-10 Thread Trass3r
Wouldn't a regular array with a couple of free functions work? You will get a lot of reallocations. For non-trivial applications you need some more sophisticated approach to alter the size of the array and maybe also deterministic memory management. A queue is a commonly used technique so

ddoc file on command line

2010-08-10 Thread Yao G.
According to the DDOC spec (http://digitalmars.com/d/2.0/ddoc.html) if you want to redefine some macros, one way is to pass one file with the .ddoc extension to the command line, but it doesn't work in my setup. For example, suppose I have the file yao.date.calendar, and I want to generate

Re: ddoc file on command line

2010-08-10 Thread Yao G.
I forgot to mention that I'm using the latest (beta) version of DMD 2 on Windows XP. On Tue, 10 Aug 2010 20:52:18 -0500, Yao G. nospam...@gmail.com wrote: According to the DDOC spec (http://digitalmars.com/d/2.0/ddoc.html) if you want to redefine some macros, one way is to pass one file