Re: Checking that a template parameter is an enum

2015-10-02 Thread Nordlöw via Digitalmars-d-learn
On Friday, 2 October 2015 at 02:39:56 UTC, Meta wrote: Highly doubtful as CTFE already allocates like there's no tomorrow. Could that memory usage be tested somehow?

Re: Checking that a template parameter is an enum

2015-10-02 Thread John Colvin via Digitalmars-d-learn
On Thursday, 1 October 2015 at 22:26:39 UTC, Nordlöw wrote: On Thursday, 1 October 2015 at 02:06:48 UTC, Fusxfaranto wrote: /** Returns: true iff all values $(D V) are the same. */ template allSame(V...) // TODO restrict to values only { static if (V.length <= 1) enum bool

Re: Checking that a template parameter is an enum

2015-10-02 Thread John Colvin via Digitalmars-d-learn
On Friday, 2 October 2015 at 08:13:00 UTC, John Colvin wrote: On Thursday, 1 October 2015 at 22:26:39 UTC, Nordlöw wrote: On Thursday, 1 October 2015 at 02:06:48 UTC, Fusxfaranto wrote: [...] Thanks! BTW: Is there some way to turn the recursive definition of `allSame` template allSame(V..

Re: How to break gdb on D exception ?

2015-10-02 Thread Dmitri via Digitalmars-d-learn
On Friday, 2 October 2015 at 04:50:59 UTC, BBasile wrote: On Friday, 2 October 2015 at 04:46:51 UTC, BBasile wrote: On Friday, 2 October 2015 at 04:24:11 UTC, Adam D. Ruppe wrote: On Friday, 2 October 2015 at 03:58:45 UTC, BBasile wrote: none of the following GB commands work: give break d_

chunkBy limitation?

2015-10-02 Thread Dmitri via Digitalmars-d-learn
I wondered if this is a current limitation of chunkBy implementation: // http://dpaste.dzfl.pl/52d6a0c5d0ab void bar(int[] foo) { bool less(int a, int b) // contrived { return a < b; }; foo.sort!less.groupBy; } resulting in: /opt/compilers/dmd2/

Linker error with dmd

2015-10-02 Thread Chris via Digitalmars-d-learn
Why do I get this error msg with dmd 2.067.1 and 2.068.0 in release mode: $ dub --build=release (.data._D65TypeInfo_xC3std5range10interfaces18__T10InputRangeTiZ10InputRange6__initZ+0x10): undefined reference to `_D64TypeInfo_C3std5range10interfaces18__T10InputRangeTiZ10InputRange6__initZ' col

Re: How to do unittests

2015-10-02 Thread Namal via Digitalmars-d-learn
On Wednesday, 30 September 2015 at 14:44:20 UTC, qsdf wrote: On Wednesday, 30 September 2015 at 14:20:28 UTC, Namal wrote: On Wednesday, 30 September 2015 at 13:03:52 UTC, Rikki Cattermole wrote: On 01/10/15 1:59 AM, Namal wrote: Hello, can someone give me a complete example please how to do

Re: Interval Arithmetic

2015-10-02 Thread ponce via Digitalmars-d-learn
On Thursday, 1 October 2015 at 21:13:30 UTC, Marco Leise wrote: Nice to have in Phobos. I assume you have to set the correct control word depending on whether you perform math on the FPU or via SSE (as is standard for x86_64)? And I assume further that DMD always uses FPU math and other compi

problem with exceptions

2015-10-02 Thread steven kladitis via Digitalmars-d-learn
C:\d\examples>pb2 =>main's first line =>makeOmelet's first line =>prepareAll's first line =>prepareEggs's first line object.Exception@pb2.d(64): Cannot take -8 eggs from the fridge 0x00402252 0x0040512F 0x00405043 0x00403E48 0x7600338A in BaseThreadInitThunk 0x77A497F2

Re: How to do unittests

2015-10-02 Thread Atila Neves via Digitalmars-d-learn
On Friday, 2 October 2015 at 10:22:40 UTC, Namal wrote: On Wednesday, 30 September 2015 at 14:44:20 UTC, qsdf wrote: On Wednesday, 30 September 2015 at 14:20:28 UTC, Namal wrote: [...] D unit tests are like a stack of free functions. You put them separatly. when there's a main: dmd -unitt

Re: problem with exceptions

2015-10-02 Thread Dmitri via Digitalmars-d-learn
On Friday, 2 October 2015 at 11:44:21 UTC, steven kladitis wrote: C:\d\examples>pb2 =>main's first line =>makeOmelet's first line =>prepareAll's first line =>prepareEggs's first line object.Exception@pb2.d(64): Cannot take -8 eggs from the fridge 0x00402252 0x0040512F

Re: Checking that a template parameter is an enum

2015-10-02 Thread Per Nordlöw via Digitalmars-d-learn
On Thursday, 1 October 2015 at 22:37:57 UTC, Ali Çehreli wrote: template allSame(V...) if (isExpressions!(V)) { bool impl_(V...)() { static if (V.length > 1) { foreach (i, _; V[0 .. $ - 1]) { if (V[i] != V[i + 1]) { return false;

Re: problem with exceptions

2015-10-02 Thread steven kladitis via Digitalmars-d-learn
On Friday, 2 October 2015 at 12:18:36 UTC, Dmitri wrote: On Friday, 2 October 2015 at 11:44:21 UTC, steven kladitis wrote: C:\d\examples>pb2 =>main's first line =>makeOmelet's first line =>prepareAll's first line =>prepareEggs's first line object.Exception@pb2.d(64): Cannot take -8 e

Re: problem with exceptions

2015-10-02 Thread Dmitri via Digitalmars-d-learn
On Friday, 2 October 2015 at 12:45:38 UTC, steven kladitis wrote: On Friday, 2 October 2015 at 12:18:36 UTC, Dmitri wrote: On Friday, 2 October 2015 at 11:44:21 UTC, steven kladitis wrote: C:\d\examples>pb2 =>main's first line =>makeOmelet's first line =>prepareAll's first line =>pr

Re: Linker error with dmd

2015-10-02 Thread John Colvin via Digitalmars-d-learn
On Friday, 2 October 2015 at 09:43:54 UTC, Chris wrote: Why do I get this error msg with dmd 2.067.1 and 2.068.0 in release mode: $ dub --build=release (.data._D65TypeInfo_xC3std5range10interfaces18__T10InputRangeTiZ10InputRange6__initZ+0x10): undefined reference to `_D64TypeInfo_C3std5range

Re: problem with exceptions

2015-10-02 Thread Mike Parker via Digitalmars-d-learn
On Friday, 2 October 2015 at 11:44:21 UTC, steven kladitis wrote: C:\d\examples>pb2 =>main's first line =>makeOmelet's first line =>prepareAll's first line =>prepareEggs's first line object.Exception@pb2.d(64): Cannot take -8 eggs from the fridge 0x00402252 0x0040512F

Re: How to do unittests

2015-10-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 02, 2015 10:22:38 Namal via Digitalmars-d-learn wrote: > So do I understand it right that it stops after the first failed > test? Is it possible to continue and get a list of all failed > tests? Once a unittest block within a module has a failure in it, then no more unittest blo

Re: problem with exceptions

2015-10-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 02, 2015 11:44:19 steven kladitis via Digitalmars-d-learn wrote: > C:\d\examples>pb2 > =>main's first line >=>makeOmelet's first line > =>prepareAll's first line >=>prepareEggs's first line > object.Exception@pb2.d(64): Cannot take -8 eggs from the fridge >

Re: Checking that a template parameter is an enum

2015-10-02 Thread Meta via Digitalmars-d-learn
On Friday, 2 October 2015 at 07:52:22 UTC, Nordlöw wrote: On Friday, 2 October 2015 at 02:39:56 UTC, Meta wrote: Highly doubtful as CTFE already allocates like there's no tomorrow. Could that memory usage be tested somehow? Your favourite process monitor I guess.

Re: chunkBy limitation?

2015-10-02 Thread Ali Çehreli via Digitalmars-d-learn
On 10/02/2015 02:21 AM, Dmitri wrote: > I wondered if this is a current limitation of chunkBy implementation: > > // http://dpaste.dzfl.pl/52d6a0c5d0ab > void bar(int[] foo) > { > bool less(int a, int b) // contrived > { > return a < b; > }; > > foo.sort!less.groupBy;

Re: Checking that a template parameter is an enum

2015-10-02 Thread Nordlöw via Digitalmars-d-learn
On Friday, 2 October 2015 at 16:21:22 UTC, Meta wrote: Could that memory usage be tested somehow? Your favourite process monitor I guess. Any suggestions on an evil D snippet that stress tests different implementations of the above mentioned traits?

Re: Checking that a template parameter is an enum

2015-10-02 Thread Meta via Digitalmars-d-learn
On Friday, 2 October 2015 at 18:52:22 UTC, Nordlöw wrote: On Friday, 2 October 2015 at 16:21:22 UTC, Meta wrote: Could that memory usage be tested somehow? Your favourite process monitor I guess. Any suggestions on an evil D snippet that stress tests different implementations of the above m

How to use std.range.interfaces in pure @safe code

2015-10-02 Thread Freddy via Digitalmars-d-learn
How do I use http://dlang.org/phobos/std_range_interfaces.html in pure @safe code?

Re: chunkBy limitation?

2015-10-02 Thread Dmitri via Digitalmars-d-learn
On Friday, 2 October 2015 at 18:16:59 UTC, Ali Çehreli wrote: On 10/02/2015 02:21 AM, Dmitri wrote: > [...] implementation: > [...] Error: > [...] function > [...] less).SortedRange.groupBy!().groupBy > [...] the nested > [...] compilation error. > [...] Group should > [...] This is a known D is

How will std.allocator change how we program in D?

2015-10-02 Thread Taylor Hillegeist via Digitalmars-d-learn
I do not come from a c++ background. but have looked at what allocators do for c++. I know in D the standard for memory management is garbage collection and if we want to manage it ourselfs we have to do things like @nogc. I was just curious how the std allocator will change how we do things.

Re: How will std.allocator change how we program in D?

2015-10-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Friday, 2 October 2015 at 23:54:18 UTC, Taylor Hillegeist wrote: I do not come from a c++ background. but have looked at what allocators do for c++. I know in D the standard for memory management is garbage collection and if we want to manage it ourselfs we have to do things like @nogc. I wa

OT: interesting talk by Jane Street technical guy on why they used Ocaml

2015-10-02 Thread Laeeth Isharc via Digitalmars-d-learn
https://www.youtube.com/watch?v=hKcOkWzj0_s a little old but still relevant. talks about importance of brevity and strong types for readability (also avoiding boilerplate). two of the partners there committed to read every line of code (originally because they were terrified). very hard to

AWS API Dlang, hmac sha256 function.

2015-10-02 Thread holo via Digitalmars-d-learn
Hello I'm trying to contact AWS API with D according to documentation: http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html there is written example in python which i want to rewrite to D: http://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html I want to ask

Re: AWS API Dlang, hmac sha256 function.

2015-10-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 03/10/15 4:11 PM, holo wrote: Hello I'm trying to contact AWS API with D according to documentation: http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html there is written example in python which i want to rewrite to D: http://docs.aws.amazon.com/general/latest/gr/sigv4-signed-re

Re: AWS API Dlang, hmac sha256 function.

2015-10-02 Thread holo via Digitalmars-d-learn
On Saturday, 3 October 2015 at 03:15:21 UTC, Rikki Cattermole wrote: You could implement it yourself, (it looks pretty easy). Or go the route of Botan: https://github.com/etcimon/botan/blob/3bdc835d5b9bad7523deaa86fe98b1fbb2f09d6b/source/botan/mac/hmac.d Thank you for answer. I used dub to f

Re: AWS API Dlang, hmac sha256 function.

2015-10-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 03/10/15 4:54 PM, holo wrote: On Saturday, 3 October 2015 at 03:15:21 UTC, Rikki Cattermole wrote: You could implement it yourself, (it looks pretty easy). Or go the route of Botan: https://github.com/etcimon/botan/blob/3bdc835d5b9bad7523deaa86fe98b1fbb2f09d6b/source/botan/mac/hmac.d Tha

Re: AWS API Dlang, hmac sha256 function.

2015-10-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 03/10/15 6:01 PM, Rikki Cattermole wrote: On 03/10/15 4:54 PM, holo wrote: On Saturday, 3 October 2015 at 03:15:21 UTC, Rikki Cattermole wrote: You could implement it yourself, (it looks pretty easy). Or go the route of Botan: https://github.com/etcimon/botan/blob/3bdc835d5b9bad7523deaa86fe