Re: CTFE difference between dmd and ldc2

2017-01-07 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Thursday, 29 December 2016 at 09:57:25 UTC, Joseph Rushton Wakeling wrote: On Thursday, 29 December 2016 at 09:24:23 UTC, Joseph Rushton Wakeling wrote: Sorry for delay in following up on this. Yes, the same problem occurs with dmd 2.071 (as installed from the deb package downloaded from

template instance does not match template declaration

2017-01-07 Thread Fabrice Marie via Digitalmars-d-learn
Hi, On my first attempt to create a templated class, I'm hitting an issue that I can't seem to resolve. I've dustmite'd the code down to: class Cache(O, K, F) { } void main() { class BasicObject { } BasicObject lookupBasicObject() { }

Re: template instance does not match template declaration

2017-01-07 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 8 January 2017 at 03:27:26 UTC, Fabrice Marie wrote: Hi, On my first attempt to create a templated class, I'm hitting an issue that I can't seem to resolve. I've dustmite'd the code down to: class Cache(O, K, F) { } void main() { class BasicObject { }

Re: template instance does not match template declaration

2017-01-07 Thread Meta via Digitalmars-d-learn
On Sunday, 8 January 2017 at 03:27:26 UTC, Fabrice Marie wrote: void main() { Cache!(BasicObject, string, lookupBasicObject); } In addition to what Nicholas Wilson said, what you're doing here is the equivalent of writing `int;`. It doesn't make any sense as Cache!(...) is

Re: Resources for using std.allocator

2017-01-07 Thread Seb via Digitalmars-d-learn
On Saturday, 7 January 2017 at 19:50:14 UTC, dewitt wrote: On Wednesday, 4 January 2017 at 04:50:55 UTC, xtreak wrote: I am newbie to D learning it for sometime using Ali's book. I came across std.experimental.allocator and read through

Re: Iterate module membres

2017-01-07 Thread ketmar via Digitalmars-d-learn
On Saturday, 7 January 2017 at 13:45:53 UTC, crimaniak wrote: Ok, I found it: https://issues.dlang.org/show_bug.cgi?id=16044 yep. sorry, my search-fu is completely broken, so i didn't provide you with the number.

Re: Iterate module membres

2017-01-07 Thread ketmar via Digitalmars-d-learn
On Saturday, 7 January 2017 at 12:11:20 UTC, crimaniak wrote: Is this a bug or documentation problem? well, it's hard to say. package.d is one of the cases where you *have* to provide explicit module definition. ;-) 'cause implicit one creates module with name `package`, which is teh

Re: Iterate module membres

2017-01-07 Thread crimaniak via Digitalmars-d-learn
On Saturday, 7 January 2017 at 10:38:29 UTC, ketmar wrote: On Saturday, 7 January 2017 at 10:27:51 UTC, Nicholas Wilson wrote: Do you require a module statement per chance? it doesn't matter. if there is no explicit module declaration, compiler will insert implicit one. from the code PoV,

Re: Iterate module membres

2017-01-07 Thread ketmar via Digitalmars-d-learn
p.s.: otherwise, it *should* work with explicit module declaration. but then, we have some well-known bugs with cross-module introspection, and some heisenbugs with package introspection.

Re: Iterate module membres

2017-01-07 Thread crimaniak via Digitalmars-d-learn
On Saturday, 7 January 2017 at 12:29:34 UTC, ketmar wrote: On Saturday, 7 January 2017 at 12:11:20 UTC, crimaniak wrote: Is this a bug or documentation problem? well, it's hard to say. package.d is one of the cases where you *have* to provide explicit module definition. ;-) 'cause implicit

Re: Really easy optimization with std.experimental.allocator

2017-01-07 Thread Dicebot via Digitalmars-d-learn
On Sunday, 18 September 2016 at 01:44:10 UTC, Ryan wrote: I think it works because each time you call dispose it tells the GC to mark that memory as available, without the GC needing to do a collection sweep. This could be a really useful tip in the allocators section, as I see converting to

Primality test function doesn't work on large numbers?

2017-01-07 Thread Elronnd via Digitalmars-d-learn
I'm working on writing an RSA implementation, but I've run into a roadblock generating primes. With a more than 9 bits, my program either hangs for a long time (utilizing %100 CPU!) or returns a composite number. With 9 or fewer bits, I get primes, but I have to run with a huge number of

Re: Iterate module membres

2017-01-07 Thread crimaniak via Digitalmars-d-learn
Ok, I found it: https://issues.dlang.org/show_bug.cgi?id=16044

Iterate module membres

2017-01-07 Thread crimaniak via Digitalmars-d-learn
Hi! I need to iterate module members and find specific classes (and make tuple). class foo{}; pragma (msg, __traits(allMembers,mixin(__MODULE__))); gives me empty tuple. I found also this thread from 2011:

Re: Iterate module membres

2017-01-07 Thread ketmar via Digitalmars-d-learn
On Saturday, 7 January 2017 at 09:46:54 UTC, crimaniak wrote: Hi! I need to iterate module members and find specific classes (and make tuple). class foo{}; pragma (msg, __traits(allMembers,mixin(__MODULE__))); gives me empty tuple. works like a charm both in 2.071 and in git HEAD.

Re: Iterate module membres

2017-01-07 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 7 January 2017 at 09:46:54 UTC, crimaniak wrote: Hi! I need to iterate module members and find specific classes (and make tuple). class foo{}; pragma (msg, __traits(allMembers,mixin(__MODULE__))); gives me empty tuple. I found also this thread from 2011:

Re: Iterate module membres

2017-01-07 Thread ketmar via Digitalmars-d-learn
On Saturday, 7 January 2017 at 10:27:51 UTC, Nicholas Wilson wrote: Do you require a module statement per chance? it doesn't matter. if there is no explicit module declaration, compiler will insert implicit one. from the code PoV, there is no difference at all.