Re: Why Does Dscanner Warn About a Missing toHash if opEquals is Defined?

2016-08-02 Thread BLM768 via Digitalmars-d-learn
On Sunday, 31 July 2016 at 18:57:50 UTC, Jack Stouffer wrote: Next question: what's the fastest hashing implementation that will provide the least collisions? Is there a hash implementation that's perfered for AAs? I've heard that FNV-1a is a decent general-purpose option, and it's fairly

Re: Why Does Dscanner Warn About a Missing toHash if opEquals is Defined?

2016-07-31 Thread BLM768 via Digitalmars-d-learn
On Sunday, 31 July 2016 at 16:39:59 UTC, Jack Stouffer wrote: But D provides a default toHash for every type if it's not defined. I was wondering why not just rely on that version. If two objects are equal, their hashes must also be equal. Consider this example: struct Nullable(T) { bool

Re: Iterate all visible symbols, even from imported modules

2016-07-18 Thread BLM768 via Digitalmars-d-learn
On Monday, 18 July 2016 at 13:00:16 UTC, Lodovico Giaretta wrote: // how do I discover that "std" is a package? I've got a DMD pull request that adds __traits(isPackage, someSymbol), but it's stuck waiting for approval. If and when it gets merged, it could be useful for that.

Keeping a reference to a linked list element

2016-05-11 Thread BLM768 via Digitalmars-d-learn
I just started working on a project in which it would be convenient to hold a reference to a specific entry in a DList. The interface doesn't seem to provide a way to get a pointer to a raw node struct, so about the best solution I can find is to get a range out of the list, pop elements until

Re: C header file: tagged enumerations

2016-04-27 Thread BLM768 via Digitalmars-d-learn
On Tuesday, 26 April 2016 at 23:40:24 UTC, Adam D. Ruppe wrote: D doesn't handle this C pattern well... you basically have to rewrite the whole thing for each version. Or you can use the technique that's used in llvm-d: build the enumeration from a string mixin which is generated from a

Re: Functions that return type

2016-01-20 Thread BLM768 via Digitalmars-d-learn
On Wednesday, 20 January 2016 at 10:04:03 UTC, burjui wrote: That's alright. Parsing and AST construction are trivial with S-expressions (Lisp-like syntax), so if you use them for the early stages of development, you can focus on the type system. When you're done with types, you can switch to

Re: Functions that return type

2016-01-19 Thread blm768 via Digitalmars-d-learn
On Sunday, 17 January 2016 at 02:08:06 UTC, Timon Gehr wrote: On 01/16/2016 11:50 PM, data pulverizer wrote: I guess the constraints are that of a static language. (This is not true.) I'm playing with the design of such a language myself. Basically, anything can create/use/return type

Re: How do you create an opengl window with DerelictOrg?

2015-12-07 Thread BLM768 via Digitalmars-d-learn
On Monday, 7 December 2015 at 21:33:57 UTC, Enjoys Math wrote: I've seen these: https://github.com/DerelictOrg?page=1 BUt not sure how to use them, examples? OpenGL itself can't create a window/context, so you'll need to use DerelictGLFW or DerelictSDL. GLFW is lighter-weight. Combine the

Re: Password Storage

2015-11-27 Thread BLM768 via Digitalmars-d-learn
On Friday, 27 November 2015 at 16:14:06 UTC, H. S. Teoh wrote: True, so you'd store hash(password01) in the database, and compute hash(X + hash(password)) during authentication. T Another option is SCRAM: https://en.wikipedia.org/wiki/Salted_Challenge_Response_Authentication_Mechanism

Re: Password Storage

2015-11-26 Thread BLM768 via Digitalmars-d-learn
On Friday, 27 November 2015 at 02:05:49 UTC, H. S. Teoh wrote: For authentication, the password shouldn't even be sent over the wire. Instead, the server (which knows the correct password) should send a challenge to the client (i.e., a large random number produced by a good RNG -- which is

Re: Something about Chinese Disorder Code

2015-11-24 Thread BLM768 via Digitalmars-d-learn
On Tuesday, 24 November 2015 at 09:48:45 UTC, magicdmer wrote: I display chinese string like: auto str = "你好,世界" writeln(str) and The display is garbled。 some windows api like MessageBoxA ,if string is chinese, it displays disorder code too i think i must use WideCharToMultiByte to convert

Finding packages recursively

2015-11-23 Thread BLM768 via Digitalmars-d-learn
I'm trying to recursively visit a package and all packages/modules within it using metaprogramming. I should be able to use __traits(allMembers, somePackage) recursively to get all symbols within the package, but is there an easy way to determine whether a symbol represents a package, a