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

Re: BUG: Initializations of named references with an empty string should trigger an error



typeset already uses -R for something else.

Right, I missed that one and -r is already used for readonly. My first choice would have been -u or -U for Unset but both are already used. Another idea was -f or -F for Forced set but again both are already used. So maybe -S for unSet or forced Set.

Why not -s? I would keep this one available to maybe one day add an explicit String/Scalar option for cases where you want to convert from any variable type to a string/scalar variable. It always bothered me that you can easily force convert to -i or -a but not to string/scalar.

Philippe


On Sun, May 25, 2025 at 11:58 PM Lawrence Velázquez <larryv@xxxxxxx> wrote:
On Sun, May 25, 2025, at 5:52 PM, Philippe Altherr wrote:
> We could add a new "typeset" option -R (reset) that would implicitly
> unset the variable before executing the "typeset".
>
> Even when TYPESET_TO_UNSET is disabled, -R is also somewhat useful for
> other variables than named references. For example, "typeset -R
> -$var_type $var_name" is more general than "typeset -$var_type
> $var_name=". The latter doesn't work for arrays.

typeset already uses -R for something else.

--
vq


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