On Wed, 12 Dec 2012, Allin Cottrell wrote:
On Wed, 12 Dec 2012, Sven Schreiber wrote:
> On 12/12/2012 04:07 PM, Allin Cottrell wrote:
>> On Wed, 12 Dec 2012, Sven Schreiber wrote:
>>
>>> I have the problem that when I declare a bundle in a script and run the
>>> script a *second* time, I get the following error:
>>>
>>> ? bundle test
>>> Invalid declaration: maybe you need the "clear" command?
>>>
>>> Error executing script: halting
>>>> bundle test
>>
>> That's by design. Declaring a variable of a given name more
>> than once is a scripting error (always has been). You can
>> redefine a variable OK, but you cannot re-declare it;
>> re-declaration probably means the writer has forgotten about a
>> variable. But the "clear" command is there if you need it, to
>> give yourself a tabula rasa.
>
> Wait a second, I have run my scripts repeatedly all the time, with all
> the matrix and series declarations in them, without clearing out stuff
> all the time explicitly.
>
> Oh, or I guess there's a difference between pure *declaration* and
> *assignment*? That would make sense, because only for bundles it's
> necessary to do a pure declaration, so that would be new for me.
Yes, that would be the explanation.
> Still, 'clear' is a bit too heavy as it also throws away the data... Hm.
I guess we could add an option to "clear" so that the dataset is preserved
while everything else is cleared.
Or maybe this is a better solution (now in CVS): I've allowed
assignment of the form
bundle b = null
This means that a variable of type bundle doesn't have to be
created by means of a bare declaration, and its existing
content (if any) content can be scrubbed in one go.
Allin