Maple programming is certainly full of pitfalls for the unwary and the inexperienced as my recent difficulty demonstrates.
I have encountered disconcerting behaviour in the way the Maple type system treats tables and names as a result of last name evaluation. In my case, it created a rather difficult debugging session in a procedure I was writing.
Specifically, in a procedure where a defined table is an argument, within the procedure the table satisfies the type test for a table, as well as for a name and a symbol. In retrospect, I realize that this makes sense when last name evaluation is in play, but I don't recall any mention of this particular side effect in the help files describing parameter processing or tables. (or I forgot)
Once identified the problem, I found two fixes:
1) test for a table before I testing for a name(symbol).
2) use eval(T) as the argument when calling the procedure.
I feel a bit uneasy about the first approach because I'm not certain there isn't some pitfall writing a procedure where the order of execution changes the outcome. Is the second approach the best way (as a rule of thumb) to feed a table into a procedure.
A somewhat artifical worksheet is attached to illustrate the problem and these approaches.