I know it's just a comment but generally
Attribute VB_PredeclaredId = True ' Client code cannot use `new` Keyword
It doesn't mean that the client code cannot use the new keyword. Changing the attribute to true
means that this class can also act like a regular standard coding module. Which makes it an imitation of a static class static class. The client code can still use the new
keyword just fine:
Dim s As SList
Set s = New SList
' or
Dim sNew As New SList
Due to the fact that you actually can use the new
keyword your Nil
function becomes obsolete. For example in your Copy
function you have this:
Dim result As SList
Set result = Nil
Which seems to be nothing else but a wrapper for Set result = new SList
.
Also, your ToArray()
throws a Subscript out of Range
runtime error if SList
is empty. You may want to handle that by checking either size
variable or Length
property is at least > 0
. Your ToCollection
would also be affected (would fail) since it uses ToArray
call in the for each loop
.
Trying to call a s.Item(0)
throws a variable not declared error for the seq
variable. Where is that dimensioned and initialized in your code?
I know it's just a comment but generally
Attribute VB_PredeclaredId = True ' Client code cannot use `new` Keyword
It doesn't mean that the client code cannot use the new keyword. Changing the attribute to true
means that this class can also act like a regular standard coding module. Which makes it an imitation of a static class. The client code can still use the new
keyword just fine:
Dim s As SList
Set s = New SList
' or
Dim sNew As New SList
Due to the fact that you actually can use the new
keyword your Nil
function becomes obsolete. For example in your Copy
function you have this:
Dim result As SList
Set result = Nil
Which seems to be nothing else but a wrapper for Set result = new SList
.
Also, your ToArray()
throws a Subscript out of Range
runtime error if SList
is empty. You may want to handle that by checking either size
variable or Length
property is at least > 0
. Your ToCollection
would also be affected (would fail) since it uses ToArray
call in the for each loop
.
Trying to call a s.Item(0)
throws a variable not declared error for the seq
variable. Where is that dimensioned and initialized in your code?
I know it's just a comment but generally
Attribute VB_PredeclaredId = True ' Client code cannot use `new` Keyword
It doesn't mean that the client code cannot use the new keyword. Changing the attribute to true
means that this class can also act like a regular standard coding module. Which makes it an imitation of a static class. The client code can still use the new
keyword just fine:
Dim s As SList
Set s = New SList
' or
Dim sNew As New SList
Due to the fact that you actually can use the new
keyword your Nil
function becomes obsolete. For example in your Copy
function you have this:
Dim result As SList
Set result = Nil
Which seems to be nothing else but a wrapper for Set result = new SList
.
Also, your ToArray()
throws a Subscript out of Range
runtime error if SList
is empty. You may want to handle that by checking either size
variable or Length
property is at least > 0
. Your ToCollection
would also be affected (would fail) since it uses ToArray
call in the for each loop
.
Trying to call a s.Item(0)
throws a variable not declared error for the seq
variable. Where is that dimensioned and initialized in your code?
I know it's just a comment but generally
Attribute VB_PredeclaredId = True ' Client code cannot use `new` Keyword
It doesn't mean that the client code cannot use the new keyword. Changing the attribute to true
means that this class can also act like a regular standard coding module. Which makes it an imitation of a static class. The client code can still use the new
keyword just fine:
Dim s As SList
Set s = New SList
' or
Dim sNew As New SList
Due to the fact that you actually can use the new
keyword your Nil
function becomes obsolete. For example in your Copy
function you have this:
Dim result As SList
Set result = Nil
Which seems to be nothing else but a wrapper for Set result = new SList
.
Also, your ToArray()
throws a Subscript out of Range
runtime error if SList
is empty. You may want to handle that by checking either size
variable or Length
property is at least > 0
. Your ToCollection
would also be affected (would fail) since it uses ToArray
call in the for each loop
.
Trying to call a s.Item(0)
throws a variable not declared error for the seq
variable. Where is that dimensioned and initialized in your code?