Re: Array Concatenate

2012-06-08 Thread Era Scarecrow
On Friday, 8 June 2012 at 18:49:42 UTC, Nathan M. Swan wrote: It seems like you're confusing _associative_ arrays with _regular_ arrays; they are different things. A regular array is written as T[], or an array of Ts. An associative array is written as K[V], or a map from K to V. If you have

Re: Segmentation fault hell in D

2012-06-08 Thread Andrew Wiley
On Fri, Jun 8, 2012 at 11:29 AM, Jonathan M Davis wrote: > On Friday, June 08, 2012 19:30:57 Jarl André" > @puremagic.com wrote: > > Evry single time I encounter them I yawn. It means using the next > > frickin hour to comment away code, add more log statements and > > try to eleminate whats creat

Re: floats default to NaN... why?

2012-06-08 Thread Andrew Wiley
On Thu, Jun 7, 2012 at 6:50 PM, Minas wrote: > I agree that the default value for floats/doubles should be zero. It feels > much more natural. > The point is to make sure code is correct. Initializing your variables should be what feels natural. Leaving then uninitialized is bad style, bad pract

Re: floats default to NaN... why?

2012-06-08 Thread Minas
The idea isn't being "practical" exactly. The idea was to use invalid values as defaults. Unfortunately things like ints don't have invalid values, so they chose zero. The idea is to make people initialize their variables. I understand the logic, but I still disagree. No offense :) I don't

Re: gdc and gcc object linking issues

2012-06-08 Thread Andrej Mitrovic
On 6/8/12, Kagamin wrote: > Well, I'm not a C++ pro, but I won't recommend to place > initializer in the header. That sounds odd. What would it mean? I > guess, it will mean definition, so chances are it's not what you > want. Initializers belong to definitions, and definitions belong > to .cpp, t

Re: Multi-Dimensional Associative Arrays ".get" and "in"

2012-06-08 Thread Timon Gehr
On 06/06/2012 04:17 PM, Paul wrote: I've seen examples using .get and "in" to test for keys: aa.get("hello", "salute") == "ciao" "hello" in aa Can I use this .get function or "in" operator with multi-D arrays? string[string][string][string] aa; if (["hello"][][] in aa)

Re: const version for foreach/opApply

2012-06-08 Thread Era Scarecrow
On Friday, 8 June 2012 at 16:33:28 UTC, Matthias Walter wrote: Hi, trying to traverse the entries of a std.bitmanip.BitArray I stumbled upon the following problem: In case I want to accept const(BitArray) objects, it shall look like the following (maybe using "ref const(bool)" for the deleg

Re: gdc and gcc object linking issues

2012-06-08 Thread Kagamin
On Thursday, 7 June 2012 at 23:58:21 UTC, Andrej Mitrovic wrote: I didn't know I had to either have an initializer in the header or have a .cpp file with the definition. Well, I'm not a C++ pro, but I won't recommend to place initializer in the header. That sounds odd. What would it mean? I

Re: Array Concatenate

2012-06-08 Thread Nathan M. Swan
On Friday, 8 June 2012 at 12:41:13 UTC, Paul wrote: If this works... D programming book section 4.1.9 Expanding auto a = [87, 40, 10]; a ~= 42; assert(a== [87, 40, 10, 42]); why doesnt' this work? DeletedBlks ~= matchOld[0]; the dmd compiler comes back with Error: cannot append type string to

Re: Segmentation fault hell in D

2012-06-08 Thread Jonathan M Davis
On Friday, June 08, 2012 19:30:57 Jarl André" @puremagic.com wrote: > Evry single time I encounter them I yawn. It means using the next > frickin hour to comment away code, add more log statements and > try to eleminate whats creating the hell of bugz, segmantation > fault. Why can't the compiler

Re: Segmentation fault hell in D

2012-06-08 Thread Dmitry Olshansky
On 08.06.2012 21:30, "Jarl André" " wrote: Evry single time I encounter them I yawn. It means using the next frickin hour to comment away code, add more log statements and try to eleminate whats creating the hell of bugz, segmantation fault. Why can't the compiler tell me anything else than the f

Re: Segmentation fault hell in D

2012-06-08 Thread Justin Whear
On Fri, 08 Jun 2012 19:30:57 +0200, Jarl André wrote: > Evry single time I encounter them I yawn. It means using the next > frickin hour to comment away code, add more log statements and try to > eleminate whats creating the hell of bugz, segmantation fault. Why can't > the compiler tell me anythi

Re: Segmentation fault hell in D

2012-06-08 Thread Kai Meyer
On 06/08/2012 11:30 AM, "Jarl André" " wrote: Evry single time I encounter them I yawn. It means using the next frickin hour to comment away code, add more log statements and try to eleminate whats creating the hell of bugz, segmantation fault. Why can't the compiler tell me anything else than th

Segmentation fault hell in D

2012-06-08 Thread Jarl André
Evry single time I encounter them I yawn. It means using the next frickin hour to comment away code, add more log statements and try to eleminate whats creating the hell of bugz, segmantation fault. Why can't the compiler tell me anything else than the fact that i have referenced data that does

const version for foreach/opApply

2012-06-08 Thread Matthias Walter
Hi, trying to traverse the entries of a std.bitmanip.BitArray I stumbled upon the following problem: The original code is as follows: int opApply(scope int delegate(ref bool) dg) { int result; for (size_t i = 0; i < len; i++) { bool b = opIndex(i); result = dg(b); this[i] = b;

Re: Array Append

2012-06-08 Thread Dmitry Olshansky
On 08.06.2012 18:50, Paul wrote: On Friday, 8 June 2012 at 12:50:56 UTC, Dmitry Olshansky wrote: On 08.06.2012 16:42, Paul wrote: On Friday, 8 June 2012 at 12:41:13 UTC, Paul wrote: If this works... D programming book section 4.1.9 Expanding auto a = [87, 40, 10]; a ~= 42; assert(a== [87, 40,

Re: Array Concatenate

2012-06-08 Thread Jonathan M Davis
On Friday, June 08, 2012 14:41:10 Paul wrote: > If this works... > > D programming book section 4.1.9 Expanding > auto a = [87, 40, 10]; > a ~= 42; > assert(a== [87, 40, 10, 42]); That compiles just fine. > why doesnt' this work? > > DeletedBlks ~= matchOld[0]; > > the dmd compiler comes back

Re: Array Append

2012-06-08 Thread Ali Çehreli
On 06/08/2012 07:50 AM, Paul wrote: > string[ulong] is a standard array > ulong[string] would be associativeNO? No, they are both associative arrays. string[ulong] is a mapping from ulong to string, ulong[string] is a mapping from string to ulong. Ali -- D Programming Language Tutorial:

Re: Array Append

2012-06-08 Thread Paul
On Friday, 8 June 2012 at 12:50:56 UTC, Dmitry Olshansky wrote: On 08.06.2012 16:42, Paul wrote: On Friday, 8 June 2012 at 12:41:13 UTC, Paul wrote: If this works... D programming book section 4.1.9 Expanding auto a = [87, 40, 10]; a ~= 42; assert(a== [87, 40, 10, 42]); why doesnt' this work?

Re: Array Append

2012-06-08 Thread Dmitry Olshansky
On 08.06.2012 16:42, Paul wrote: On Friday, 8 June 2012 at 12:41:13 UTC, Paul wrote: If this works... D programming book section 4.1.9 Expanding auto a = [87, 40, 10]; a ~= 42; assert(a== [87, 40, 10, 42]); why doesnt' this work? DeletedBlks ~= matchOld[0]; the dmd compiler comes back with E

Re: Array Append

2012-06-08 Thread Paul
On Friday, 8 June 2012 at 12:41:13 UTC, Paul wrote: If this works... D programming book section 4.1.9 Expanding auto a = [87, 40, 10]; a ~= 42; assert(a== [87, 40, 10, 42]); why doesnt' this work? DeletedBlks ~= matchOld[0]; the dmd compiler comes back with Error: cannot append type string to

Array Concatenate

2012-06-08 Thread Paul
If this works... D programming book section 4.1.9 Expanding auto a = [87, 40, 10]; a ~= 42; assert(a== [87, 40, 10, 42]); why doesnt' this work? DeletedBlks ~= matchOld[0]; the dmd compiler comes back with Error: cannot append type string to type string[ulong] Does this append operator only w

Re: std.net.curl get webpage asia font issue

2012-06-08 Thread Dmitry Olshansky
On 08.06.2012 5:03, Sam Hu wrote: On Thursday, 7 June 2012 at 10:43:32 UTC, Dmitry Olshansky wrote: string content = get("dlang.org"); It's simple this line you "convert" whatever site content was to unicode. Problem is that "convert" is either broken or it's simply a cast whereas it should re