Playing around with BitArray I encountered the seemingly strange interface of

-------
bool[] b = [0, 1, 0];

BitArray a;
a.init(b);
-------

Is there any reason 'init' is used rather than using a constructor?

--------
bool[] b = [0, 1, 0];

BitArray a = BitArray(b);
--------

Seems a bit clearer. Regardless, the current approach seems to create problems when used with std.parallelism. Specifically the following fails to compile:

--------
BitArray[] arr;
arr ~= BitArray();

taskPool.amap!((BitArray a) {/*do something*/})(arr);
--------
Fails with:
Error: function std.bitmanip.BitArray.init (bool[] ba) is not callable using argument types ()

Can anyone explain the reason for this setup?

Reply via email to