The documentation states the following:
If ‘+’ appears by itself in a separate word as the last option, then the names of all parameters (functions with -f) are printed, but the values (function bodies) are not. If name arguments appear, both those names and their values are printed in the form of assignments. It is an error for any other options to follow ‘+’, but the effect of ‘+’ is as if all attribute flags which precede it were given with a ‘+’ prefix. For example, ‘typeset -U +’ is equivalent to ‘typeset +U’ and displays the names of all arrays having the uniqueness attribute, whereas ‘typeset -f -U +’ displays the names of all autoloadable functions. If ‘+’ is the only option, then type information (array, readonly, etc.) is also printed for each parameter, in the same manner as ‘typeset +m "*"’.
I understand this as meaning that the '+' option is a mechanism to print information about existing parameters. There are however a number of scenarios where nothing is printed and parameters are modified or created while '+' is present:
- 'typeset +' prints the name and type of all parameters => ok
- 'typeset -i +' prints the name of all integer parameters => ok
- 'typeset -t +' prints the name of all tagged parameters => ok
- 'typeset -i -t +' prints the name of all integer parameters => okish
Why not print only tagged integer parameters? - 'typeset + str int' prints the name and value of the listed parameters => ok
- 'typeset -i + str int' prints nothing but turns the listed parameters into integers => KO
Why does that change the type of the parameters?
Shouldn't this just print the name and value of either all the listed parameters or of just the ones that are integers? - 'typeset + undef' prints nothing and creates a string parameter => KO
Why does this create a parameter? - 'typeset + str=abc int=1+2' prints nothing and assigns the parameters => ???
The documentation of '+' states nothing about assignments but my expectation was that the values would be ignored and that this would behave like 'typeset + str int', similar to what happens with '-p'.
Is all of the above expected or should the parameter modifications/creations be considered as bugs?
Philippe