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

Re: sysexits.h codes? (was: Re: [RFC][PATCH] `newuser` prompt theme)



Bart Schaefer wrote on Fri, Apr 30, 2021 at 14:34:15 -0700:
> I wonder if we could do a trick sort of like we do when declaring
> SECONDS as float, i.e., convert signals into a hash if one runs
>   typeset -A signals

${SECONDS}'s type is lexically scoped.  This is implemented by
special-casing ${SECONDS} in scanendscope().  I'm not sure I like adding
even more special cases; if anything, I'd rather have fewer (e.g., make
$SECONDS always a float in zsh 6.0).

Bart Schaefer wrote on Fri, Apr 30, 2021 at 14:40:06 -0700:
> Incidentally it would have to be either an associative array mapping
> numbers to names (perhaps with the sort of ordering guarantee that is
> applied to $history), or an associative array with mappings in both
> directions, sort of like $color as set up by the colors function.

Or it could be an assoc mapping symbolic names to integer values, and 
named something other than ${signals}.

> 

By the way:

diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 36c1ae4c2..2f84e5728 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -840,8 +840,9 @@ will be the value that was assigned plus the number of seconds
 since the assignment.
 
 Unlike other special parameters, the type of the tt(SECONDS) parameter can
-be changed using the tt(typeset) command.  Only integer and one of the
-floating point types are allowed.  For example, `tt(typeset -F SECONDS)'
+be changed using the tt(typeset) command.  The type may be changed only
+to one of the floating point types or back to integer.  For example,
+`tt(typeset -F SECONDS)'
 causes the value to be reported as a floating point number.  The
 value is available to microsecond accuracy, although the shell may
 show more or fewer digits depending on the use of tt(typeset).  See





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