Question: basic question on returning indexed symbol from proc

I want to have a proc, which returns an expression using an indexed symbol. The proc needs to basically generate constansts to use to build an expression, similar to how dsolve uses _Cn.  But I do not want to use _Cn for this so not to confuse the expression with another one that was generated using _Cn already.

So I thought to use a local symbol say A.  (I could have used _Zn also, but I think _Z is also used by Maple).

The symbol A is first declared local to the proc, and then the proc returns the expression using A[n]. For example  A[0]*x+A[1]*x^2 etc... The number of A[n]'s is not known before hand, but should not be more than 10. 

I want to make sure that A[n] returned is really part of the local symbol and not different symbol to avoid clash with any global A[n] 

When I do the following check

restart;
foo:=proc()
 local A;
 return A[99]
end proc;

expr:=foo()

type(expr,`global`)

gives

good. So Maple says that A[99] is not global. But when I do

type(expr,`local`)

it also says false!

My question is: When making local A , will A[1] and A[2] also be local, or are they different symbols? Maplemint says nothing about it, so I assume A[n] is local also?

maplemint(foo)
Procedure foo() 
  These local variables were used but never assigned a value:  A

It did not say that A[99] was never declared local. This tells me that A[99] is local, because A is local. But then why did type(expr,`local`)  say false?

Please Wait...