Tango BitArray Initialization
terminal.node at gmail.com
Sun Feb 11 16:36:21 PST 2007
On Sat, 10 Feb 2007 09:10:07 -0500, Colin Huang wrote:
> When reading the Tango documentation, I came across this piece of code:
> import tango.core.BitArray;
> void main()
> BitArray bitbag1 = bits( 1,0,1,1,1,0 );
> // or
> BitArray bitbag2( 1,0,1,1,1,0 );
> The documentation says that "bitbag2 is initialized such that it uses a special opCall overload for the BitArray".
> Now the problem is that when I look at the source code, I don't see any overload of opCall for BitArray, or any definition for the bits function. Am I missing anything here?
> BTW, is the last line legal D code at all? It doesn't look like it's gonna compile (to me, at least).
The Doc is innacurrate in this respect on both
counts. The "bits" function and "opCall" do not exist.
When I wrote it, I was hoping that Tango would implement a "simple"
way to initialize the BitArray. There were a number of options at the
time, but nothing happened in this case because there were greater
priorities. The examples above were intended to be suggestions for easier
initialization syntax. What bothered me at the time was that there was no
simple single line initialization of the BitArray... it involved two or
more steps and more lines of code: creation of the bitarray and then
initialization. What I was looking for was a simple one line
(The last line could be legal if an opCall were implemented.)
We'll get the doc fixed for now and explore the possibilities a little more.
More information about the Digitalmars-d-learn