Re: observation: D getting a bit complex

2015-08-30 Thread Jack Stouffer via Digitalmars-d-learn
On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote: immutable(ElementEncodingType!(ElementType!Range))[] buildPath(Range)(Range segments) if (isInputRange!Range isSomeString!(ElementType!Range)); pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][] paths...) if

Re: Error Compiling with -debug swtich

2015-08-30 Thread BBasile via Digitalmars-d-learn
On Thursday, 27 August 2015 at 22:09:07 UTC, Jordan Wilson wrote: Hello, Just wondering why compiling the following fails with the -debug switch, but appears to compile and execute fine without it: import std.stdio; import std.algorithm; import std.container; int main(string[] args) {

Re: observation: D getting a bit complex

2015-08-30 Thread BBasile via Digitalmars-d-learn
On Sunday, 30 August 2015 at 10:42:24 UTC, Spacen Jasset wrote: On Sunday, 30 August 2015 at 07:36:55 UTC, BBasile wrote: On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote: immutable(ElementEncodingType!(ElementType!Range))[] buildPath(Range)(Range segments) if (isInputRange!Range

Re: Reading and converting binary file 2 bits at a time

2015-08-30 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 30 August 2015 at 00:02:16 UTC, anonymous wrote: On Saturday, 29 August 2015 at 23:34:47 UTC, Gary Willoughby wrote: But it might not be safe: http://forum.dlang.org/thread/ztefzijqhwrouzlag...@forum.dlang.org That link just takes me to this thread here again. Here's the correct

Re: observation: D getting a bit complex

2015-08-30 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Sunday, 30 August 2015 at 07:36:55 UTC, BBasile wrote: On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote: immutable(ElementEncodingType!(ElementType!Range))[] buildPath(Range)(Range segments) if (isInputRange!Range isSomeString!(ElementType!Range)); pure nothrow @safe

Re: observation: D getting a bit complex

2015-08-30 Thread BBasile via Digitalmars-d-learn
On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote: immutable(ElementEncodingType!(ElementType!Range))[] buildPath(Range)(Range segments) if (isInputRange!Range isSomeString!(ElementType!Range)); pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][] paths...) if

Re: observation: D getting a bit complex

2015-08-30 Thread cym13 via Digitalmars-d-learn
On Sunday, 30 August 2015 at 09:55:02 UTC, Dominikus Dittes Scherkl wrote: And the constraints you need not read - unless you want to understand why your call to the function failed. C++ is just lacking without them. Having them avoids that you always have to handle ridiculous input within

Re: stuck on opDiv / opBinary

2015-08-30 Thread Spacen Jasset via Digitalmars-d-learn
On Sunday, 30 August 2015 at 18:12:40 UTC, BBasile wrote: On Sunday, 30 August 2015 at 17:02:58 UTC, Spacen Jasset wrote: [...] try --- Vector3 opBinary(string op)(Vector3 rhs) { static if (op ==/){} else static assert(0, op ~ not implemented); } --- you used the char litteral

Re: How to get the current Timezone

2015-08-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, August 29, 2015 05:25:33 rumbu via Digitalmars-d-learn wrote: On Friday, 28 August 2015 at 23:03:16 UTC, Jonathan M Davis wrote: I _really_ wish that Microsoft would just use the TZ database like everyone else... - Jonathan M Davis Starting with Windows 8.1, it does, but

Re: stuck on opDiv / opBinary

2015-08-30 Thread BBasile via Digitalmars-d-learn
On Sunday, 30 August 2015 at 17:02:58 UTC, Spacen Jasset wrote: I have just added an opDiv to this class, but it doesn't seem to pick it up. math/vector.d(30): Error: 'this /= mag' is not a scalar, it is a Vector3 I can't see why that is, becuase my opMul works in the same place. Can anyone

Re: What is the D way to map a binary file to a structure?

2015-08-30 Thread Atila Neves via Digitalmars-d-learn
On Saturday, 29 August 2015 at 12:56:08 UTC, cym13 wrote: Hi, Let's say I have a simple binary file whose structure is well-known. Here is an example which stores points: struct Point { long x; long y; long z; } struct BinFile { uintmagicNumber; // Some identifier

Re: observation: D getting a bit complex

2015-08-30 Thread Spacen Jasset via Digitalmars-d-learn
On Sunday, 30 August 2015 at 07:36:55 UTC, BBasile wrote: On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote: immutable(ElementEncodingType!(ElementType!Range))[] buildPath(Range)(Range segments) if (isInputRange!Range isSomeString!(ElementType!Range)); pure nothrow @safe

Re: observation: D getting a bit complex

2015-08-30 Thread anonymous via Digitalmars-d-learn
On Sunday 30 August 2015 04:42, Spacen Jasset wrote: immutable(ElementEncodingType!(ElementType!Range))[] buildPath(Range)(Range segments) if (isInputRange!Range isSomeString!(ElementType!Range)); pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][] paths...) if (isSomeChar!C);

Re: stuck on opDiv / opBinary

2015-08-30 Thread John Colvin via Digitalmars-d-learn
On Sunday, 30 August 2015 at 17:02:58 UTC, Spacen Jasset wrote: I have just added an opDiv to this class, but it doesn't seem to pick it up. math/vector.d(30): Error: 'this /= mag' is not a scalar, it is a Vector3 I can't see why that is, becuase my opMul works in the same place. Can anyone

Re: observation: D getting a bit complex

2015-08-30 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Aug 30, 2015 at 07:36:53AM +, BBasile via Digitalmars-d-learn wrote: On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote: immutable(ElementEncodingType!(ElementType!Range))[] buildPath(Range)(Range segments) if (isInputRange!Range isSomeString!(ElementType!Range));

Re: stuck on opDiv / opBinary

2015-08-30 Thread Timon Gehr via Digitalmars-d-learn
On 08/30/2015 07:02 PM, Spacen Jasset wrote: I have just added an opDiv to this class, but it doesn't seem to pick it up. math/vector.d(30): Error: 'this /= mag' is not a scalar, it is a Vector3 I can't see why that is, becuase my opMul works in the same place. Can anyone point out what I have

Re: observation: D getting a bit complex

2015-08-30 Thread bachmeier via Digitalmars-d-learn
On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote: The following reminds me of the good old C++ template errors the C++ compiler spits out. Whilst D has fixed that problem, some things have gotten more complex. I just wanted to find a replacement for D1 path join, and found

stuck on opDiv / opBinary

2015-08-30 Thread Spacen Jasset via Digitalmars-d-learn
I have just added an opDiv to this class, but it doesn't seem to pick it up. math/vector.d(30): Error: 'this /= mag' is not a scalar, it is a Vector3 I can't see why that is, becuase my opMul works in the same place. Can anyone point out what I have done wrong? Class Matrix { void

Re: stuck on opDiv / opBinary

2015-08-30 Thread Spacen Jasset via Digitalmars-d-learn
On Sunday, 30 August 2015 at 20:09:25 UTC, Timon Gehr wrote: On 08/30/2015 07:02 PM, Spacen Jasset wrote: [...] import std.math: sqrt; import std.algorithm: map,sum,canFind; struct Vector3{ float[3] xyz; void normalise(){ this/=magnitude(); } float magnitude(){ return

how does vibe's PrivateAccessProxy work

2015-08-30 Thread yawniek via Digitalmars-d-learn
can someone explain a bit how the @before hooks works in detail, i mainly have problems understanding why ensureAuth in belows example refers to SampleService. as an instance:

Re: What is the D way to map a binary file to a structure?

2015-08-30 Thread mzfhhhh via Digitalmars-d-learn
On Saturday, 29 August 2015 at 12:56:08 UTC, cym13 wrote: Hi, Let's say I have a simple binary file whose structure is well-known. Here is an example which stores points: struct Point { long x; long y; long z; } struct BinFile { uintmagicNumber; // Some identifier

Can't chain reduce(seed, range)

2015-08-30 Thread Yuxuan Shui via Digitalmars-d-learn
Why is reduce defined as 'auto reduce(S, R)(S seed, R r)', instead of reduce(R r, S seed)? I can't chain it. Maybe provide both?

Re: Array initialization with Struct templates

2015-08-30 Thread Ali Çehreli via Digitalmars-d-learn
On 08/30/2015 10:38 PM, Jonathan M Davis via Digitalmars-d-learn wrote: On Monday, August 31, 2015 04:57:05 WhatMeWorry via Digitalmars-d-learn wrote: This seemingly trivial array initialization has caused me hours of grief. enum Purpose { POSITIONAL, COLOR_ONLY, COLOR_AND_ALPHA,

Re: Can't chain reduce(seed, range)

2015-08-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, August 31, 2015 01:31:58 Yuxuan Shui via Digitalmars-d-learn wrote: Why is reduce defined as 'auto reduce(S, R)(S seed, R r)', instead of reduce(R r, S seed)? I can't chain it. Maybe provide both? The reasons why the seed is first are historical. It predates UFCS being added to the

Re: Array initialization with Struct templates

2015-08-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, August 31, 2015 04:57:05 WhatMeWorry via Digitalmars-d-learn wrote: This seemingly trivial array initialization has caused me hours of grief. enum Purpose { POSITIONAL, COLOR_ONLY, COLOR_AND_ALPHA, GENERIC_TRIPLE, GENERIC_QUAD } Purpose purpose; struct Chameleon(T, Purpose p)

Array initialization with Struct templates

2015-08-30 Thread WhatMeWorry via Digitalmars-d-learn
This seemingly trivial array initialization has caused me hours of grief. enum Purpose { POSITIONAL, COLOR_ONLY, COLOR_AND_ALPHA, GENERIC_TRIPLE, GENERIC_QUAD } Purpose purpose; struct Chameleon(T, Purpose p) // template { static if (is (p == POSITIONAL)) { T x, y, z; }