That helps. I feel better since I seem to have been close!

Dave
At 01:53 PM 4/30/2012, you wrote:
I admit to some considerable confusion over your request now.

In your example below, s5 is not an array; it is a class that happens
to contain an array. Assuming you define the normal push/pop/etc.
methods in clsStack for it, you would do things like

dim s5
SET S5 = (NEW CLS_Stack).Init(MaxDepth)
s5.push("Hello")
s5.push("there!")
sThere = s5.pop()

The actual array accesses go on inside the clsStack class. (You might
actually be able to allow indexing of your class as if it were itself
an array by defining item(idx) as a default method, but I have never
tried that.)

Your desired examples

SET S5 = NEW CLS_Stack(MaxDepth)
Set S12 = NEW Cls_Stack(MonthsPerYear)

become in practice

SET S5 = NEW CLS_Stack.init(MaxDepth)
Set S12 = NEW Cls_Stack.init(MonthsPerYear)

but otherwise should work identically to what you would expect.

On Mon, Apr 30, 2012 at 01:42:52PM -0700, David Helkenn wrote:
Thanks, Ron,

I don't think so. It is more like instantiating a stack class with
each instance of that class (a stack object) having a "MaxDepth" space
allocated to it. Then each time I "NEW CLS_Stack", I would get a stack
object of "MaxDepth" elements. (I am ignoring the TopOfStack, Push,
Pop, etc. for now.)

What I think I'm hearing from Doug and Aaron is that the stack is
actually defined outside the context of the class.  If I then want a
stack of "MaxDepth", I have to call the "CLS_Stack.Init (MaxDepth)" in
order to obtain an array named  S5. I think I then need:

SET S5 = (NEW CLS_Stack).Init(MaxDepth)
which will make S5 an array of "MaxDepth" elements. So, my confusion
and question really comes down to, "Where do I declare the array that
is my stack?" I thought I could do it inside the Class block,
hopefully parameterizing the class somehow so that I could have
something like:

SET S5 = NEW CLS_Stack(MaxDepth)
and
Set S12 = NEW Cls_Stack(MonthsPerYear)
etc.

I understand this is not permitted as VBS does not support
parameterizing a class. This is a shame IMHO because so many classes
seem to be a natural "List" of other objects.

Redim can certainly handle the dynamic fluctuations in the depth of a
stack, but that seems to me to be operative only after the stack is
set up in the first place.

I can imagine a whole collection of objects organized in all manner of
data structures -- queues, trees, graphs, ... All of these structures
could be restricted to a given, well defined, set of some number of
objects.

So, on to the WIKI articles which I assume are at AppCentral. Thanks,
Aaron, for that lead.

Dave

At 11:01 AM 4/30/2012, you wrote:
>On 4/30/2012 1:52 PM, David Helkenn wrote:
>>private someStack ' AARRGGGG how many?
>
>Does redim solve this problem for you?
>
>http://msdn.microsoft.com/en-us/library/c850dt17%28v=vs.84%29.aspx
>

--
Doug Lee, Senior Accessibility Programmer
SSB BART Group - Accessibility-on-Demand
mailto:[email protected]  http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller

Reply via email to