Re: CT Inheritence structures

2016-08-19 Thread Enamex via Digitalmars-d-learn
On Saturday, 20 August 2016 at 00:46:15 UTC, Engine Machine wrote: I am trying to get Timon Gehr's code working, with some modifications: void main() { import std.traits; auto a = new Type!("Animal", "Dog", "Pug")(); Type!("Animal", "Dog") b = a; Type!("

CT Inheritence structures

2016-08-19 Thread Engine Machine via Digitalmars-d-learn
I am trying to get Timon Gehr's code working, with some modifications: public template TypeParent(P) { import std.traits; alias T = TemplateArgsOf!P; alias Seq(T...) = T; static if (T.length == 0 || is(typeof(T[0]) == typeof(null))) {

Re: MurmurHash3 behaviour

2016-08-19 Thread Cauterite via Digitalmars-d-learn
On Friday, 19 August 2016 at 21:03:22 UTC, Seb wrote: http://dlang.org/phobos-prerelease/std_digest_murmurhash.html Ah great, I just finished writing my own murmurhash digest module ( https://github.com/Cauterite/phobos/blob/murmur/std/digest/murmur.d ), and now I discover someone's already d

Re: MurmurHash3 behaviour

2016-08-19 Thread Seb via Digitalmars-d-learn
On Friday, 19 August 2016 at 20:28:13 UTC, Cauterite wrote: Regarding the MurmurHash3 implementation in core.internal.hash, it is my understanding that: // assuming a and b are uints bytesHash([a, b], 0) == bytesHash([b], bytesHash([a], 0)) Is this correct? I'm just not quite certain of

MurmurHash3 behaviour

2016-08-19 Thread Cauterite via Digitalmars-d-learn
Regarding the MurmurHash3 implementation in core.internal.hash, it is my understanding that: // assuming a and b are uints bytesHash([a, b], 0) == bytesHash([b], bytesHash([a], 0)) Is this correct? I'm just not quite certain of this property when I try to read the code myself, and I don'

Re: typeof.stringof wrong type

2016-08-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 19 August 2016 at 18:52:02 UTC, Jonathan M Davis wrote: Unfortunately, once you start doing stuff with things like __traits(allMembers, ...), you're dealing with strings You should immediately go back into symbol land by passing that string into __traits(getMember). I agree that s

Re: typeof.stringof wrong type

2016-08-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 19, 2016 15:36:02 David Nadlinger via Digitalmars-d-learn wrote: > On Friday, 19 August 2016 at 15:15:55 UTC, ag0aep6g wrote: > > I think that qualifies as a bug, because fullyQualifiedName is > > supposed to be usable in code generation. > > This is a misconception. Neither .str

Re: typeof.stringof wrong type

2016-08-19 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 19 August 2016 at 15:47:00 UTC, ag0aep6g wrote: https://dlang.org/spec/property.html#stringof Someone should edit that, if fullyQualifiedName is no good either. Indeed. I'm sure the change was well-intentioned, but symbol visibility/import concerns and Voldemort types should make

Re: typeof.stringof wrong type

2016-08-19 Thread ag0aep6g via Digitalmars-d-learn
On 08/19/2016 05:36 PM, David Nadlinger wrote: This is a misconception. Neither .stringof nor fullyQualifiedName should *ever* be used in code generation. The spec itself recommends fullyQualifiedName for code generation: Note: Using .stringof for code generation is not recommended, as the in

Re: typeof.stringof wrong type

2016-08-19 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 19 August 2016 at 15:15:55 UTC, ag0aep6g wrote: I think that qualifies as a bug, because fullyQualifiedName is supposed to be usable in code generation. This is a misconception. Neither .stringof nor fullyQualifiedName should *ever* be used in code generation. There is a myriad of

Re: typeof.stringof wrong type

2016-08-19 Thread ag0aep6g via Digitalmars-d-learn
On 08/19/2016 02:42 PM, Eugene Wissner wrote: fullyQualifiedName doesn't work with BitFlags for example: I think that qualifies as a bug, because fullyQualifiedName is supposed to be usable in code generation.

Re: typeof.stringof wrong type

2016-08-19 Thread Eugene Wissner via Digitalmars-d-learn
fullyQualifiedName doesn't work with BitFlags for example: import std.stdio; import std.typecons; import std.traits; enum Stuff { asdf } void main() { BitFlags!Stuff a; typeof(a) b; mixin(fullyQualifiedName!(typeof(a)) ~ " c;"); mixin(typeof(a).stringof

Re: Serialize/Deserialize Tuple

2016-08-19 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 19 August 2016 at 09:55:32 UTC, Steve Biedermann wrote: I'm trying to send data over the network. On the receiving side, I need a tuple of the sent values. Is there any way to achieve this? Depends on the format the data is send in. There are a number of serialization/deserializati

Re: RSA library

2016-08-19 Thread Kagamin via Digitalmars-d-learn
On Thursday, 18 August 2016 at 17:56:54 UTC, Andre wrote: I will try the windows api, from the description it seems exactly what i need. CNG was introduced in Vista if it matters.

Serialize/Deserialize Tuple

2016-08-19 Thread Steve Biedermann via Digitalmars-d-learn
I'm trying to send data over the network. On the receiving side, I need a tuple of the sent values. Is there any way to achieve this?