Bug 13806 – std.bitmanip.BitArray -- use of methods named init() messes up templates

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-12-01T21:06:00Z
Last change time
2017-07-20T15:34:05Z
Keywords
pull
Assigned to
nobody
Creator
erikas.aubade

Comments

Comment #0 by erikas.aubade — 2014-12-01T21:06:05Z
It seems to be pretty common and accepted practice to use the static init field to get default values of an arbitrary templated type--however this pattern will fail hard on types like BitArray that have methods name init(), and no overloads that can be called without parameters. It'd make life a lot easier if these methods could be renamed to something like initialize().
Comment #1 by hsteoh — 2014-12-16T15:54:20Z
IMO, proper ctors should be used instead of init(), since that is essentially what they do.
Comment #2 by hsteoh — 2015-01-07T23:44:58Z
Comment #3 by peter.alexander.au — 2015-01-11T20:09:58Z
Actual pull (you posted wrong link) https://github.com/D-Programming-Language/phobos/pull/2854 :-)
Comment #4 by github-bugzilla — 2015-01-24T20:01:03Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/588c76c19b2619361f37084ec4bcaa95f7f03417 Merge pull request #2854 from quickfur/bitarray_init Issue 13806: BitArray should not define member function called init()
Comment #5 by hsteoh — 2015-01-24T20:32:25Z
Are there any other instances of init abuse in Phobos, or can we close this now?
Comment #6 by github-bugzilla — 2015-02-18T03:41:29Z
Comment #7 by razvan.nitu1305 — 2017-07-20T15:34:05Z
This seems to have been solved. If there are other cases of init abuse, one can always file a new bug report. Closing as fixed.