Small bug in LotusScript Vector class

The problem occurs when calling the RemoveAllElements() method since the Vector isn’t reset correctly, though all elements are removed.

The method should be changed from:

Public Sub removeAllElements()
	Dim i As Integer
	For i = 0 To Me.size() - 1
		If Isobject(array(i)) Then
			Set array(i) = Nothing
		Else
			array(i) = ""
		End If
	Next i
End Sub

to:

Public Sub removeAllElements()
	Dim i As Integer
	For i = 0 To Me.size() - 1
		If Isobject(array(i)) Then
			Set array(i) = Nothing
		Else
			array(i) = ""
		End If
	Next i

	'reset vector
	elementLength = 0
	ensureCapacity(10)
End Sub

I also did a simple extension of the Vector class to create a Set (or “Zet” since “Set” is a reserved word in LotusScript).

Published by

lekkim

Positive, competent, out-spoken, frank and customer focused architect and developer with a strong foundation in web, cloud and product development. I'm a strong advocate for API first and cloud based solutions and development. I have a knack for being able to communicate and present technically complicated matters in conference, customer and training settings. I've previously acted as team member and leader in a product organisation.