digitalmars.D.bugs - [Issue 16973] New: `hashOf` has error-prone signature as `(T, seed)`
- via Digitalmars-d-bugs (25/25) Dec 15 2016 https://issues.dlang.org/show_bug.cgi?id=16973
https://issues.dlang.org/show_bug.cgi?id=16973 Issue ID: 16973 Summary: `hashOf` has error-prone signature as `(T, seed)` may be confused with `(ptr, length)` Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: verylonglogin.reg gmail.com In our root `object` module we have a function `hashOf` [1] which accept any type as the first parameter and optional seed as the second parameter. This function signature is error-prone because its signature allows this incorrect usage: --- hashOf(arr.ptr, arr.length); // hash of ptr with seed set to length --- It's a major issue as (ptr, length) usage pattern is common in programming and incorrect hash function behavior is hard to debug. [1] http://dlang.org/phobos/object.html#.hashOf --
Dec 15 2016