Hi Dan,

(from function/objects/Array.st):

Array size_: _size value_: _value
[
    self := self new: (SmallInteger value_: _size).
    _oops := _value.
    {
      int i;
      for (i= 0;  i < (int)v__size;  ++i)
        ((oop *)self->v__oops)[i]= *((oop **)v__value)[i];
    }.
]

This is the constructor that the compiler invokes implicitly whenever you write an Array literal "#( ... )" in a program. The argument _value points to a C array of oops corresponding to "..." in your constant and _size is an int reflecting the number of entries in the C array.

What is that "_oops := _value." doing?

_oops is an instance variable of the receiver, which by line 2 is a new Arrray of size _size. The line in question makes the C array containing "..." be the contents of the Array object.

Cheers,
Ian


_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to