Skip to content

Vectors are not read properly from archives #4

Description

@olafklingt

Vectors are not read from archive because the _ArrayOverwrite primitive fails.
_ArrayOverwrite expects arrays of the same type.
A solution that worked for me was to add this function to the AbstractVector Class. Unfortunately it makes the Archive much slower to be read.

`

overWrite { arg aCollection, pos=0;

	var array, grow;

	// _ArrayOverwrite

	// ^this.primitiveFailed

	array = this.growClear(pos + aCollection.size - this.size);

	grow = pos + aCollection.size - this.size;

	if (grow > 0, { array = this ++ this.class.newClear(grow); },{ array = this });

	aCollection.do({ arg item, i; array.put(pos + i, item); });

	^array

}

`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions