On Tue, 16 Oct 2018, oleg_komashko(a)ukr.net wrote:
List components of bundles are non-usable:
nulldata 20
y = normal()
x = normal()
ols y 0 x
mod = $model
function void fun7(bundle *b)
list xx = b.xlist
end function
fun7(&mod)
This did not caused "penetration"
before "prohibition"
Actually it did support penetration, you just had to pass the bundled
list on to another function. Here's an example:
<hansl>
function void F2 (list L)
print "Trouble in store!"
end function
function void F1 (bundle *b)
matrix x = I(3)
F2(b.xlist)
end function
nulldata 20
y = normal()
x = normal()
ols y 0 x
mod = $model
F1(&mod) # OK, or so it seems
F1(&mod) # broken on second call
</hansl>
(Note: this won't run on current git without reverting the new guard
against ID theft.)
Here's what's happening. When you pass a list to a function, the
member series have their "stack level" temporarily incremented so
they're accessible within the function. Then on exit from the function
the stack level is decremented so the series "go back to where they
really belong."
Suppose function F1 "steals" a reference to some series at main level
rather than coming by it honestly via an argument. F1 passes a stolen
list on to F2: the stack level of the members becomes 2. Then we
return to F1, and their stack level goes to 1. But it never goes back
to 0, as it should, because of course there's no record of F1 having
obtained a reference to the series from main.
In the case of a bundled list, it seems we'll have to treat that in
the same way as a plain list argument, which we have not been doing so
far: we need to create a record of origin of the member series.
Allin