As of this commit when a tied array is declared but neither the scalar
nor the array has an initializer, the array is initialized to empty.
The scalar struct param of a tied pair stores a direct pointer to the
internal array value of the array struct param, and upon assignment
modifies it without referring to the containing struct. This means
that there's no opportunity to clear the PM_DECLAREDNULL bits on both
structs when the scalar is assigned. Conversely, assigning to the
array does use the struct for the scalar.
This addresses the issue that "typeset foo" creates $foo set to an
empty string, which differs from typeset handling in bash and ksh.
It does this by concealing the internal value rather than alter
the way internal values are defaulted.
This imposes the following changes:
A typeset variable with no assignment triggers NO_UNSET warnings
when the name is used in parameter expansion or math.
The typeset -AEFHLRTZailux options are applied upon the first
assignment to the variable. Explicit unset before the first
assignment discards all of those properties. If any option is
applied to an existing name, historic behavior is unchanged.
Consequent to the foregoing, the (t) parameter expansion flag
prints nothing until after the first assignment, and the (i)
and (I) subscript flags also print nothing.
The bash behavior of "unset foo; typeset -p foo" is NOT used.
This is called out as an emulation distinction, not a change.
The test cases have not been updated, so several now fail.
The test harness has been updated to declare default values.
Combine logic for case after committed to exit (shell_exiting) with
case where exit occurred in a function we nee to unwind (exit_pending).
Add sarky note for future generations to be confused at.
Works for both normal and typeset case, also var+=...
Still to do: allow to be mixed with straight array assignment,
improve typeset -p, implement [key]+=value.
This sets the shell emulation mode similarly to ARGV0=... which
doesn't work from other shells.
Note that this gives more comprehensive emulation than running
emulate within the shell.
Doesn't complain if module is unavailable, but prints more
obscure errors.
Use existing low-level silent flag by passing through
intermediate module loading hierarchy.
This adds the capability for mathematical functions based on shell
functions to have a string argument. Module functions have had
this for a long time.