Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: One possible answer to typeset vs. unset



On 2020-11-28 11:49:12 -0800, Bart Schaefer wrote:
> 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.

OK for the second sentence (about unset), but I don't understand the
first sentence. Could you explain the following behavior?

zira% ./zsh -c 'typeset -i x; echo $x; echo $((x+3)); unset x; echo $((x+3));'

3
3
zira% ./zsh -c 'typeset -E x; echo $x; echo $((x+3)); unset x; echo $((x+3));'

3.
3
zira%

Why do I get "3." if the -E option isn't supposed to be applied yet?

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Messages sorted by: Reverse Date, Date, Thread, Author